# ICustomStorageInterface&lt;TState, TDelta&gt; Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.eventsourcing/orleans.eventsourcing.customstorage.icustomstorageinterface-2/)

## ApplyUpdatesToStorage(IReadOnlyList&lt;TDelta&gt;, int) {#applyupdatestostorage-system-collections-generic-ireadonlylist-tdelta-int-beafa6cb}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.eventsourcing/orleans.eventsourcing.customstorage.icustomstorageinterface-2/methods/applyupdatestostorage-system-collections-generic-ireadonlylist-tdelta-int-beafa6cb/)

```csharp
public abstract Task<bool> ICustomStorageInterface<TState, ApplyUpdatesToStorage(IReadOnlyList<TDelta> updates, int expectedVersion)
```

Applies the given array of deltas to storage, and returns true, if the version in storage matches the expected version. Otherwise, does nothing and returns false. If successful, the version of storage must be increased by the number of deltas.

### Parameters

- `updates` (`IReadOnlyList<TDelta>`)
- `expectedVersion` (`int`)

### Returns

true if the deltas were applied, false otherwise

## ClearStoredState {#clearstoredstate-9a06061f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.eventsourcing/orleans.eventsourcing.customstorage.icustomstorageinterface-2/methods/clearstoredstate-9a06061f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.EventSourcing/CustomStorage/ICustomStorageInterface.cs#L31)

```csharp
public virtual Task ICustomStorageInterface<TState, ClearStoredState()
```

Clears the stored state in storage.

### Returns

A task that represents the asynchronous clear operation.

## ReadStateFromStorage {#readstatefromstorage-19da459d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.eventsourcing/orleans.eventsourcing.customstorage.icustomstorageinterface-2/methods/readstatefromstorage-19da459d/)

```csharp
public abstract Task<KeyValuePair<int, TState>> ICustomStorageInterface<TState, ReadStateFromStorage()
```

Reads the current state and version from storage (note that the state object may be mutated by the provider, so it must not be shared).

### Returns

the version number and a state object.
