Skip to content

Commit

Permalink
Allow empty keys to be used in API.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhartnett committed Jul 8, 2024
1 parent e3bb842 commit a854cd0
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 33 deletions.
9 changes: 0 additions & 9 deletions rocksdb/rocksdb.nim
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,6 @@ proc get*(
## The `onData` callback reduces the number of copies and therefore should be
## preferred if performance is required.

if key.len() == 0:
return err("rocksdb: key is empty")

var
len: csize_t
errors: cstring
Expand Down Expand Up @@ -283,9 +280,6 @@ proc put*(
): RocksDBResult[void] =
## Put the value for the given key into the specified column family.

if key.len() == 0:
return err("rocksdb: key is empty")

var errors: cstring
rocksdb_put_cf(
db.cPtr,
Expand Down Expand Up @@ -351,9 +345,6 @@ proc delete*(
## If the value does not exist, the delete will be a no-op.
## To check if the value exists before or after a delete, use `keyExists`.

if key.len() == 0:
return err("rocksdb: key is empty")

var errors: cstring
rocksdb_delete_cf(
db.cPtr,
Expand Down
9 changes: 0 additions & 9 deletions rocksdb/transactions/transaction.nim
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ proc get*(
## Get the value for a given key from the transaction using the provided
## `onData` callback.

if key.len() == 0:
return err("rocksdb: key is empty")

var
len: csize_t
errors: cstring
Expand Down Expand Up @@ -114,9 +111,6 @@ proc put*(
): RocksDBResult[void] =
## Put the value for the given key into the transaction.

if key.len() == 0:
return err("rocksdb: key is empty")

var errors: cstring
rocksdb_transaction_put_cf(
tx.cPtr,
Expand All @@ -140,9 +134,6 @@ proc delete*(
): RocksDBResult[void] =
## Delete the value for the given key from the transaction.

if key.len() == 0:
return err("rocksdb: key is empty")

var errors: cstring
rocksdb_transaction_delete_cf(
tx.cPtr,
Expand Down
6 changes: 0 additions & 6 deletions rocksdb/writebatch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ proc put*(
): RocksDBResult[void] =
## Add a put operation to the write batch.

if key.len() == 0:
return err("rocksdb: key is empty")

rocksdb_writebatch_put_cf(
batch.cPtr,
cfHandle.cPtr,
Expand All @@ -74,9 +71,6 @@ proc delete*(
): RocksDBResult[void] =
## Add a delete operation to the write batch.

if key.len() == 0:
return err("rocksdb: key is empty")

rocksdb_writebatch_delete_cf(
batch.cPtr, cfHandle.cPtr, cast[cstring](unsafeAddr key[0]), csize_t(key.len)
)
Expand Down
9 changes: 0 additions & 9 deletions rocksdb/writebatchwi.nim
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ proc put*(
): RocksDBResult[void] =
## Add a put operation to the write batch.

if key.len() == 0:
return err("rocksdb: key is empty")

rocksdb_writebatch_wi_put_cf(
batch.cPtr,
cfHandle.cPtr,
Expand All @@ -88,9 +85,6 @@ proc delete*(
): RocksDBResult[void] =
## Add a delete operation to the write batch.

if key.len() == 0:
return err("rocksdb: key is empty")

rocksdb_writebatch_wi_delete_cf(
batch.cPtr, cfHandle.cPtr, cast[cstring](unsafeAddr key[0]), csize_t(key.len)
)
Expand All @@ -106,9 +100,6 @@ proc get*(
## Get the value for a given key from the batch using the provided
## `onData` callback.

if key.len() == 0:
return err("rocksdb: key is empty")

var
len: csize_t
errors: cstring
Expand Down

0 comments on commit a854cd0

Please sign in to comment.