Package com.salesforce.cantor
Interface Objects
-
- All Superinterfaces:
Namespaceable
public interface Objects extends Namespaceable
Objects expose functionalities to work with key/value pairs.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleandelete(String namespace, String key)Delete the object; return true if object was found and removed successfully, false otherwise.default voiddelete(String namespace, Collection<String> keys)Delete batch of objects.byte[]get(String namespace, String key)Returns bytes associated to the given key.default Map<String,byte[]>get(String namespace, Collection<String> keys)Returns batch of key/values for the list of entries.default Collection<String>keys(String namespace, int start, int count)Returns paginated list of entries; the returned list is not ordered.Collection<String>keys(String namespace, String prefix, int start, int count)Returns paginated list of entries; the returned list is not ordered.intsize(String namespace)Returns number of key/value pairs in the given namespace.voidstore(String namespace, String key, byte[] bytes)Stores bytes for the given key.default voidstore(String namespace, Map<String,byte[]> batch)Stores batch of key/value pairs.-
Methods inherited from interface com.salesforce.cantor.Namespaceable
create, drop
-
-
-
-
Method Detail
-
store
void store(String namespace, String key, byte[] bytes) throws IOException
Stores bytes for the given key.- Parameters:
namespace- the namespace identifierkey- the keybytes- the value in bytes- Throws:
IOException- exception thrown from the underlying storage implementation
-
store
default void store(String namespace, Map<String,byte[]> batch) throws IOException
Stores batch of key/value pairs.- Parameters:
namespace- the namespace identifierbatch- batch of key/value pairs- Throws:
IOException- exception thrown from the underlying storage implementation
-
get
byte[] get(String namespace, String key) throws IOException
Returns bytes associated to the given key.- Parameters:
namespace- the namespace identifierkey- the key- Returns:
- bytes associated to the key in the given namespace; null if not found
- Throws:
IOException- exception thrown from the underlying storage implementation
-
get
default Map<String,byte[]> get(String namespace, Collection<String> keys) throws IOException
Returns batch of key/values for the list of entries.- Parameters:
namespace- the namespace identifierkeys- batch of keys- Returns:
- map of key/value pairs for the given list of keys in the namespace; value is set to null if not found
- Throws:
IOException- exception thrown from the underlying storage implementation
-
delete
boolean delete(String namespace, String key) throws IOException
Delete the object; return true if object was found and removed successfully, false otherwise.- Parameters:
namespace- the namespace identifierkey- the key- Returns:
- true if key is found and deleted, false otherwise
- Throws:
IOException- exception thrown from the underlying storage implementation
-
delete
default void delete(String namespace, Collection<String> keys) throws IOException
Delete batch of objects.- Parameters:
namespace- the namespace identifierkeys- batch of keys- Throws:
IOException- exception thrown from the underlying storage implementation
-
keys
default Collection<String> keys(String namespace, int start, int count) throws IOException
Returns paginated list of entries; the returned list is not ordered.- Parameters:
namespace- the namespace identifierstart- start offsetcount- maximum number of entries to return; -1 for infinite- Returns:
- paginated list of keys in the namespace
- Throws:
IOException- exception thrown from the underlying storage implementation
-
keys
Collection<String> keys(String namespace, String prefix, int start, int count) throws IOException
Returns paginated list of entries; the returned list is not ordered.- Parameters:
namespace- the namespace identifierprefix- to narrow down the search resultsstart- start offsetcount- maximum number of entries to return; -1 for infinite- Returns:
- paginated list of keys in the namespace
- Throws:
IOException- exception thrown from the underlying storage implementation
-
size
int size(String namespace) throws IOException
Returns number of key/value pairs in the given namespace.- Parameters:
namespace- the namespace identifier- Returns:
- number of objects in the namespace
- Throws:
IOException- exception thrown from the underlying storage implementation
-
-