pub trait MetaProtocol {
// Required methods
fn meta_get<K: AsRef<[u8]>>(
&mut self,
key: K,
is_quiet: bool,
opaque: Option<&[u8]>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>;
fn meta_set<K, V>(
&mut self,
key: K,
value: V,
is_quiet: bool,
opaque: Option<&[u8]>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>
where K: AsRef<[u8]>,
V: AsMemcachedValue;
fn meta_delete<K: AsRef<[u8]>>(
&mut self,
key: K,
is_quiet: bool,
opaque: Option<&[u8]>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>;
fn meta_increment<K: AsRef<[u8]>>(
&mut self,
key: K,
is_quiet: bool,
opaque: Option<&[u8]>,
delta: Option<u64>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>;
fn meta_decrement<K: AsRef<[u8]>>(
&mut self,
key: K,
is_quiet: bool,
opaque: Option<&[u8]>,
delta: Option<u64>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>;
}
Expand description
Trait defining Meta protocol-specific methods for the Client.
Required Methods§
Sourcefn meta_get<K: AsRef<[u8]>>(
&mut self,
key: K,
is_quiet: bool,
opaque: Option<&[u8]>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>
fn meta_get<K: AsRef<[u8]>>( &mut self, key: K, is_quiet: bool, opaque: Option<&[u8]>, meta_flags: Option<&[&str]>, ) -> impl Future<Output = Result<Option<MetaValue>, Error>>
Gets the given key with additional metadata.
If the key is found, Some(MetaValue)
is returned, describing the metadata and data of the key.
Otherwise, None
is returned.
Sourcefn meta_set<K, V>(
&mut self,
key: K,
value: V,
is_quiet: bool,
opaque: Option<&[u8]>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>
fn meta_set<K, V>( &mut self, key: K, value: V, is_quiet: bool, opaque: Option<&[u8]>, meta_flags: Option<&[&str]>, ) -> impl Future<Output = Result<Option<MetaValue>, Error>>
Sets the given key with additional metadata.
If the value is set successfully, Some(MetaValue)
is returned, otherwise Error
is returned.
NOTE: That the data in this MetaValue is sparsely populated, containing only requested data by meta_flags
The meta set command is a generic command for storing data to memcached. Based on the flags supplied,
it can replace all storage commands (see token M) as well as adds new options.
Sourcefn meta_delete<K: AsRef<[u8]>>(
&mut self,
key: K,
is_quiet: bool,
opaque: Option<&[u8]>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>
fn meta_delete<K: AsRef<[u8]>>( &mut self, key: K, is_quiet: bool, opaque: Option<&[u8]>, meta_flags: Option<&[&str]>, ) -> impl Future<Output = Result<Option<MetaValue>, Error>>
Deletes the given key with additional metadata.
If the key is found, it will be deleted, invalidated or tombstoned depending on the meta flags provided.
If data is requested back via meta flags then a MetaValue
is returned, otherwise None
.
Sourcefn meta_increment<K: AsRef<[u8]>>(
&mut self,
key: K,
is_quiet: bool,
opaque: Option<&[u8]>,
delta: Option<u64>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>
fn meta_increment<K: AsRef<[u8]>>( &mut self, key: K, is_quiet: bool, opaque: Option<&[u8]>, delta: Option<u64>, meta_flags: Option<&[&str]>, ) -> impl Future<Output = Result<Option<MetaValue>, Error>>
Performs an increment (arithmetic) operation on the given key.
If the key is found, the increment operation is performed.
If data is requested back via meta flags then a MetaValue
is returned, otherwise None
.
Command format:
ma
-
is the key string, with a maximum length of 250 bytes. -
is an optional slice of string references with a maximum length of 32 bytes. -
is an optional u64 value for the decrement delta. The default behaviour is to decrement with a delta of 1. -
<is_quiet> is a boolean value indicating whether to use quiet mode. quiet mode will append a no-op command to the request (“mn\r\n”) so that the client can proceed properly in the event of a cache miss.
-
<meta_flags> is an optional slice of string references for additional meta flags. Meta flags may have associated tokens after the initial character, e.g “N123” Do not include “M”, “D”, “O” or “q” flags as additional meta flags, they will be ignored. Instead, use the specified parameters.
Sourcefn meta_decrement<K: AsRef<[u8]>>(
&mut self,
key: K,
is_quiet: bool,
opaque: Option<&[u8]>,
delta: Option<u64>,
meta_flags: Option<&[&str]>,
) -> impl Future<Output = Result<Option<MetaValue>, Error>>
fn meta_decrement<K: AsRef<[u8]>>( &mut self, key: K, is_quiet: bool, opaque: Option<&[u8]>, delta: Option<u64>, meta_flags: Option<&[&str]>, ) -> impl Future<Output = Result<Option<MetaValue>, Error>>
Performs a decrement (arithmetic) operation on the given key.
If the key is found, the decrement operation is performed.
If data is requested back via meta flags then a MetaValue
is returned, otherwise None
.
Command format:
ma
-
is the key string, with a maximum length of 250 bytes. -
is an optional slice of string references with a maximum length of 32 bytes. -
is an optional u64 value for the decrement delta. The default behaviour is to decrement with a delta of 1. -
<is_quiet> is a boolean value indicating whether to use quiet mode. quiet mode will append a no-op command to the request (“mn\r\n”) so that the client can proceed properly in the event of a cache miss.
-
<meta_flags> is an optional slice of string references for additional meta flags. Meta flags may have associated tokens after the initial character, e.g “N123” Do not include “M”, “D”, “O” or “q” flags as additional meta flags, they will be ignored. Instead, use the specified parameters.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.