pub struct WritePolicy {
    pub base_policy: BasePolicy,
    pub record_exists_action: RecordExistsAction,
    pub generation_policy: GenerationPolicy,
    pub commit_level: CommitLevel,
    pub generation: u32,
    pub expiration: Expiration,
    pub send_key: bool,
    pub respond_per_each_op: bool,
    pub durable_delete: bool,
    pub filter_expression: Option<FilterExpression>,
}
Expand description

WritePolicy encapsulates parameters for all write operations.

Fields§

§base_policy: BasePolicy

Base policy instance

§record_exists_action: RecordExistsAction

RecordExistsAction qualifies how to handle writes where the record already exists.

§generation_policy: GenerationPolicy

GenerationPolicy qualifies how to handle record writes based on record generation. The default (NONE) indicates that the generation is not used to restrict writes.

§commit_level: CommitLevel

Desired consistency guarantee when committing a transaction on the server. The default (COMMIT_ALL) indicates that the server should wait for master and all replica commits to be successful before returning success to the client.

§generation: u32

Generation determines expected generation. Generation is the number of times a record has been modified (including creation) on the server. If a write operation is creating a record, the expected generation would be 0.

§expiration: Expiration

Expiration determimes record expiration in seconds. Also known as TTL (Time-To-Live). Seconds record will live before being removed by the server.

§send_key: bool

Send user defined key in addition to hash digest on a record put. The default is to not send the user defined key.

§respond_per_each_op: bool

For Client::operate() method, return a result for every operation. Some list operations do not return results by default (operations::list::clear() for example). This can sometimes make it difficult to determine the desired result offset in the returned bin’s result list.

Setting RespondPerEachOp to true makes it easier to identify the desired result offset (result offset equals bin’s operate sequence). This only makes sense when multiple list operations are used in one operate call and some of those operations do not return results by default.

§durable_delete: bool

If the transaction results in a record deletion, leave a tombstone for the record. This prevents deleted records from reappearing after node failures. Valid for Aerospike Server Enterprise Edition 3.10+ only.

§filter_expression: Option<FilterExpression>

Optional Filter Expression

Implementations§

source§

impl WritePolicy

source

pub fn new(gen: u32, exp: Expiration) -> Self

Create a new write policy instance with the specified generation and expiration parameters.

source

pub const fn filter_expression(&self) -> &Option<FilterExpression>

Get the current Filter expression

Trait Implementations§

source§

impl Clone for WritePolicy

source§

fn clone(&self) -> WritePolicy

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for WritePolicy

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for WritePolicy

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Policy for Twhere T: PolicyLike,

source§

fn priority(&self) -> &Priority

Transaction priority.
source§

fn consistency_level(&self) -> &ConsistencyLevel

How replicas should be consulted in read operations to provide the desired consistency guarantee.
source§

fn deadline(&self) -> Option<Instant>

source§

fn timeout(&self) -> Option<Duration>

Total transaction timeout for both client and server. The timeout is tracked on the client and also sent to the server along with the transaction in the wire protocol. The client will most likely timeout first, but the server has the capability to timeout the transaction as well. Read more
source§

fn max_retries(&self) -> Option<usize>

Maximum number of retries before aborting the current transaction. A retry may be attempted when there is a network error. If max_retries is exceeded, the abort will occur even if the timeout has not yet been exceeded.
source§

fn sleep_between_retries(&self) -> Option<Duration>

Time to sleep between retries. Set to zero to skip sleep. Default: 500ms.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V