Skip to content

Commit a032c9c

Browse files
committed
Merge branch 'master' into async
# Conflicts: # tests/src/cdt_map.rs # tests/src/exp.rs
2 parents 136fcc6 + 0743d0f commit a032c9c

File tree

13 files changed

+1177
-22
lines changed

13 files changed

+1177
-22
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [1.2.0] - 2021-10-22
8+
9+
* **New Features**
10+
* Support Aerospike server v5.6+ expressions in Operate API.
11+
12+
* **Bug Fixes**
13+
* Fix for buffer size when using CDT contexts.
14+
715
## [1.1.0] - 2021-10-12
816
This version of the client drops support for the older server versions without changing the API. `ScanPolicy.fail_on_cluster_change`, `ScanPolicy.scan_percent` and `BasePolicy.priority` are deprected for the Scan operations and will not be sent to the server. They remain in the API to avoid breaking the API.
917

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aerospike"
3-
version = "1.1.0"
3+
version = "1.2.0"
44
edition = "2018"
55
authors = ["Khosrow Afroozeh <khosrow@aerospike.com>", "Jan Hecking <jhecking@aerospike.com>"]
66
description = "Aerospike Client for Rust"

aerospike-core/src/commands/buffer.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,20 @@ impl Buffer {
494494
| OperationType::BitRead
495495
| OperationType::HllRead,
496496
..
497+
}
498+
| Operation {
499+
op: OperationType::ExpRead,
500+
..
497501
} => read_attr |= INFO1_READ,
498502
_ => write_attr |= INFO2_WRITE,
499503
}
500504

501505
let each_op = matches!(
502506
operation.data,
503-
OperationData::CdtMapOp(_) | OperationData::CdtBitOp(_)
507+
OperationData::CdtMapOp(_)
508+
| OperationData::CdtBitOp(_)
509+
| OperationData::HLLOp(_)
510+
| OperationData::EXPOp(_)
504511
);
505512

506513
if policy.respond_per_each_op || each_op {
@@ -543,7 +550,6 @@ impl Buffer {
543550
for operation in operations {
544551
operation.write_to(self)?;
545552
}
546-
547553
self.end()
548554
}
549555

aerospike-core/src/expressions/hll.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const MODULE: i64 = 2;
2323

2424
#[doc(hidden)]
2525
pub enum HllExpOp {
26+
Init = 0,
2627
Add = 1,
2728
Count = 50,
2829
Union = 51,
@@ -33,6 +34,33 @@ pub enum HllExpOp {
3334
MayContain = 56,
3435
}
3536

37+
/// Create expression that creates a new HLL or resets an existing HLL.
38+
pub fn init(
39+
policy: HLLPolicy,
40+
index_bit_count: FilterExpression,
41+
bin: FilterExpression,
42+
) -> FilterExpression {
43+
init_with_min_hash(policy, index_bit_count, int_val(-1), bin)
44+
}
45+
46+
/// Create expression that creates a new HLL or resets an existing HLL with minhash bits.
47+
pub fn init_with_min_hash(
48+
policy: HLLPolicy,
49+
index_bit_count: FilterExpression,
50+
min_hash_count: FilterExpression,
51+
bin: FilterExpression,
52+
) -> FilterExpression {
53+
add_write(
54+
bin,
55+
vec![
56+
ExpressionArgument::Value(Value::from(HllExpOp::Init as i64)),
57+
ExpressionArgument::FilterExpression(index_bit_count),
58+
ExpressionArgument::FilterExpression(min_hash_count),
59+
ExpressionArgument::Value(Value::from(policy.flags as i64)),
60+
],
61+
)
62+
}
63+
3664
/// Create expression that adds list values to a HLL set and returns HLL set.
3765
/// The function assumes HLL bin already exists.
3866
/// ```

0 commit comments

Comments
 (0)