DataStoreEditor

public protocol DataStoreEditor

Enables editing multiple entries in the module storage in a transactional way.

  • Applies a DataStoreEdit to this editor.

    Declaration

    Swift

    func apply(edit: DataStoreEdit) -> Self

    Parameters

    edit

    The DataStoreEdit to apply.

    Return Value

    the same DataStoreEditor to continue editing this storage.

  • Adds a single key-value pair into the storage.

    Declaration

    Swift

    func put(key: String, value: DataInput, expiry: Expiry) -> Self

    Parameters

    key

    The key to store the value under.

    value

    The DataInput to be stored.

    expiry

    The time frame for this data to remain stored.

    Return Value

    the same DataStoreEditor to continue editing this storage.

  • Adds all key-value pairs from the dictionary into the storage.

    Declaration

    Swift

    func putAll(dataObject: DataObject, expiry: Expiry) -> Self

    Parameters

    dataObject

    A DataObject containing the key-value pairs to be stored.

    expiry

    The time frame for this data to remain stored.

    Return Value

    the same DataStoreEditor to continue editing this storage.

  • Removes and individual key from storage.

    Declaration

    Swift

    func remove(key: String) -> Self

    Parameters

    key

    the key to remove from storage.

    Return Value

    the same DataStoreEditor to continue editing this storage.

  • Removes multiple keys from storage.

    Declaration

    Swift

    func remove(keys: [String]) -> Self

    Parameters

    keys

    the list of keys to remove from storage.

    Return Value

    the same DataStoreEditor to continue editing this storage.

  • Clears all entries from storage before then adding any key-value pairs.

    Declaration

    Swift

    func clear() -> Self

    Return Value

    the same DataStoreEditor to continue editing this storage.

  • Writes the updates to disk in a transaction.

    Calling this method multiple times is not supported, and subsequent executions are ignored.

    Declaration

    Swift

    func commit() throws