pub struct Storage { /* private fields */ }
Expand description

Access a Durable Object’s Storage API. Each method is implicitly wrapped inside a transaction, such that its results are atomic and isolated from all other storage operations, even when accessing multiple key-value pairs.

Implementations§

Retrieves the value associated with the given key. The type of the returned value will be whatever was previously written for the key, or undefined if the key does not exist.

Retrieves the values associated with each of the provided keys.

Stores the value and associates it with the given key.

Takes a serializable struct and stores each of its keys and values to storage.

Deletes the key and associated value. Returns true if the key existed or false if it didn’t.

Deletes the provided keys and their associated values. Returns a count of the number of key-value pairs deleted.

Deletes all keys and associated values, effectively deallocating all storage used by the Durable Object. In the event of a failure while the operation is still in flight, it may be that only a subset of the data is properly deleted.

Returns all keys and values associated with the current Durable Object in ascending lexicographic sorted order.

Be aware of how much data may be stored in your Durable Object before calling this version of list without options, because it will all be loaded into the Durable Object’s memory, potentially hitting its limit. If that is a concern, use the alternate list_with_options() method.

Returns keys associated with the current Durable Object according to the parameters in the provided options object.

Retrieves the current alarm time (if set) as integer milliseconds since epoch. The alarm is considered to be set if it has not started, or if it has failed and any retry has not begun. If no alarm is set, get_alarm() returns None.

Sets the current alarm time to the given datetime.

If set_alarm() is called with a time equal to or before Date.now(), the alarm will be scheduled for asynchronous execution in the immediate future. If the alarm handler is currently executing in this case, it will not be canceled. Alarms can be set to millisecond granularity and will usually execute within a few milliseconds after the set time, but can be delayed by up to a minute due to maintenance or failures while failover takes place.

Deletes the alarm if one exists. Does not cancel the alarm handler if it is currently executing.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.