Skip to content

Commit

Permalink
In key cardinality check use parameter name "part_count" instead of "…
Browse files Browse the repository at this point in the history
…parts" for consistency.
  • Loading branch information
ademakov committed Apr 29, 2012
1 parent eb2b0f8 commit 469694e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions mod/box/index.h
Expand Up @@ -130,18 +130,18 @@ struct key_def {
:(enum iterator_type) type;
- (void) initIteratorByKey: (struct iterator *) iterator
:(enum iterator_type) type
:(void *) key :(int) parts;
:(void *) key :(int) part_count;
/**
* Check key cardinality.
*/
- (void) checkKeyParts: (int) parts :(bool) partial_key_allowed;
- (void) checkKeyParts: (int) part_count :(bool) partial_key_allowed;
/**
* Unsafe search methods that do not check key cardinality.
*/
- (struct box_tuple *) findUnsafe: (void *) key :(int) key_cardinality;
- (void) initIteratorUnsafe: (struct iterator *) iterator
:(enum iterator_type) type
:(void *) key :(int) parts;
:(void *) key :(int) part_count;
@end

struct iterator {
Expand Down
58 changes: 29 additions & 29 deletions mod/box/index.m
Expand Up @@ -131,16 +131,16 @@ - (struct box_tuple *) max
return NULL;
}

- (struct box_tuple *) findByKey: (void *) key :(int) parts
- (struct box_tuple *) findByKey: (void *) key :(int) part_count
{
[self checkKeyParts: parts :false];
return [self findUnsafe: key :parts];
[self checkKeyParts: part_count :false];
return [self findUnsafe: key :part_count];
}

- (struct box_tuple *) findUnsafe: (void *) key :(int) parts
- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count
{
(void) key;
(void) parts;
(void) part_count;
[self subclassResponsibility: _cmd];
return NULL;
}
Expand Down Expand Up @@ -180,30 +180,30 @@ - (void) initIterator: (struct iterator *) iterator :(enum iterator_type) type
}

- (void) initIteratorByKey: (struct iterator *) iterator :(enum iterator_type) type
:(void *) key :(int) parts
:(void *) key :(int) part_count
{
[self checkKeyParts: parts :true];
[self initIteratorUnsafe: iterator :type :key :parts];
[self checkKeyParts: part_count :true];
[self initIteratorUnsafe: iterator :type :key :part_count];
}

- (void) initIteratorUnsafe: (struct iterator *) iterator :(enum iterator_type) type
:(void *) key :(int) parts
:(void *) key :(int) part_count
{
(void) iterator;
(void) type;
(void) key;
(void) parts;
(void) part_count;
[self subclassResponsibility: _cmd];
}

- (void) checkKeyParts: (int) parts :(bool) partial_key_allowed
- (void) checkKeyParts: (int) part_count :(bool) partial_key_allowed
{
if (parts > key_def->part_count)
if (part_count > key_def->part_count)
tnt_raise(ClientError, :ER_KEY_CARDINALITY,
parts, key_def->part_count);
if (!partial_key_allowed && parts < key_def->part_count)
part_count, key_def->part_count);
if (!partial_key_allowed && part_count < key_def->part_count)
tnt_raise(ClientError, :ER_EXACT_MATCH,
parts, key_def->part_count);
part_count, key_def->part_count);
}

@end
Expand Down Expand Up @@ -316,11 +316,11 @@ - (struct iterator *) allocIterator
return (struct iterator *) it;
}

- (void) checkKeyParts: (int) parts :(bool) partial_key_allowed
- (void) checkKeyParts: (int) part_count :(bool) partial_key_allowed
{
/* Hash indexes never allow partial keys. */
(void) partial_key_allowed;
[super checkKeyParts: parts :false];
[super checkKeyParts: part_count :false];
}

@end
Expand Down Expand Up @@ -367,9 +367,9 @@ - (size_t) size
return mh_size(int_hash);
}

- (struct box_tuple *) findUnsafe: (void *) key :(int) parts
- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count
{
(void) parts;
(void) part_count;

struct box_tuple *ret = NULL;
u32 num = int32_key_to_value(key);
Expand Down Expand Up @@ -432,9 +432,9 @@ - (void) initIterator: (struct iterator *) iterator :(enum iterator_type) type
}

- (void) initIteratorUnsafe: (struct iterator *) iterator :(enum iterator_type) type
:(void *) key :(int) parts
:(void *) key :(int) part_count
{
(void) parts;
(void) part_count;
if (type == ITER_REVERSE)
tnt_raise(IllegalParams, :"hash iterator is forward only");

Expand Down Expand Up @@ -488,9 +488,9 @@ - (size_t) size
return mh_size(int64_hash);
}

- (struct box_tuple *) findUnsafe: (void *) key :(int) parts
- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count
{
(void) parts;
(void) part_count;

struct box_tuple *ret = NULL;
u64 num = int64_key_to_value(key);
Expand Down Expand Up @@ -553,9 +553,9 @@ - (void) initIterator: (struct iterator *) iterator :(enum iterator_type) type
}

- (void) initIteratorUnsafe: (struct iterator *) iterator :(enum iterator_type) type
:(void *) key :(int) parts
:(void *) key :(int) part_count
{
(void) parts;
(void) part_count;
if (type == ITER_REVERSE)
tnt_raise(IllegalParams, :"hash iterator is forward only");

Expand Down Expand Up @@ -601,9 +601,9 @@ - (size_t) size
return mh_size(str_hash);
}

- (struct box_tuple *) findUnsafe: (void *) key :(int) parts
- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count
{
(void) parts;
(void) part_count;
struct box_tuple *ret = NULL;
mh_int_t k = mh_lstrptr_get(str_hash, key);
if (k != mh_end(str_hash))
Expand Down Expand Up @@ -670,9 +670,9 @@ - (void) initIterator: (struct iterator *) iterator :(enum iterator_type) type

- (void) initIteratorUnsafe: (struct iterator *) iterator
:(enum iterator_type) type
:(void *) key :(int) parts
:(void *) key :(int) part_count
{
(void) parts;
(void) part_count;
if (type == ITER_REVERSE)
tnt_raise(IllegalParams, :"hash iterator is forward only");

Expand Down
10 changes: 5 additions & 5 deletions mod/box/tree.m
Expand Up @@ -864,14 +864,14 @@ - (struct box_tuple *) max
return [self unfold: node];
}

- (struct box_tuple *) findUnsafe: (void *) key : (int) parts
- (struct box_tuple *) findUnsafe: (void *) key : (int) part_count
{
struct key_data *key_data
= alloca(sizeof(struct key_data) +
_SIZEOF_SPARSE_PARTS(parts));
_SIZEOF_SPARSE_PARTS(part_count));

key_data->data = key;
key_data->part_count = parts;
key_data->part_count = part_count;
fold_with_key_parts(key_def, key_data);

void *node = sptree_index_find(&tree, key_data);
Expand Down Expand Up @@ -934,13 +934,13 @@ - (void) initIterator: (struct iterator *) iterator :(enum iterator_type) type
}

- (void) initIteratorUnsafe: (struct iterator *) iterator :(enum iterator_type) type
:(void *) key :(int) parts
:(void *) key :(int) part_count
{
assert(iterator->free == tree_iterator_free);
struct tree_iterator *it = tree_iterator(iterator);

it->key_data.data = key;
it->key_data.part_count = parts;
it->key_data.part_count = part_count;
fold_with_key_parts(key_def, &it->key_data);

if (type == ITER_FORWARD) {
Expand Down

0 comments on commit 469694e

Please sign in to comment.