# IJournaledStateManager Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.ijournaledstatemanager/)

## DeleteStateAsync(CancellationToken) {#deletestateasync-system-threading-cancellationtoken-167068d8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.ijournaledstatemanager/methods/deletestateasync-system-threading-cancellationtoken-167068d8/)

```csharp
public abstract ValueTask DeleteStateAsync(CancellationToken cancellationToken)
```

Resets this instance, removing any persistent state.

### Parameters

- `cancellationToken` (`CancellationToken`): The cancellation token.

### Returns

A `System.Threading.Tasks.ValueTask` which represents the operation.

## InitializeAsync(CancellationToken) {#initializeasync-system-threading-cancellationtoken-acbac96c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.ijournaledstatemanager/methods/initializeasync-system-threading-cancellationtoken-acbac96c/)

```csharp
public abstract ValueTask InitializeAsync(CancellationToken cancellationToken)
```

Initializes the state manager.

### Parameters

- `cancellationToken` (`CancellationToken`): The cancellation token.

### Returns

A `System.Threading.Tasks.ValueTask` which represents the operation.

## RegisterState(string, IJournaledState) {#registerstate-string-orleans-journaling-ijournaledstate-4f05937b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.ijournaledstatemanager/methods/registerstate-string-orleans-journaling-ijournaledstate-4f05937b/)

```csharp
public abstract void RegisterState(string name, IJournaledState state)
```

Registers a state with the manager.

### Parameters

- `name` (`string`): The state's stable identifier.
- `state` (`IJournaledState`): The state instance to register.

## TryGetState(string, IJournaledState?) {#trygetstate-string-out-orleans-journaling-ijournaledstate-nullable-7546212e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.ijournaledstatemanager/methods/trygetstate-string-out-orleans-journaling-ijournaledstate-nullable-7546212e/)

```csharp
public abstract bool TryGetState(string name, out IJournaledState? state)
```

Attempts to get a state registered with the manager.

### Parameters

- `name` (`string`): The state's stable identifier.
- `state` (`IJournaledState?`): The state instance, if one is registered for `name`.

## WriteStateAsync(CancellationToken) {#writestateasync-system-threading-cancellationtoken-d05c0b46}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.ijournaledstatemanager/methods/writestateasync-system-threading-cancellationtoken-d05c0b46/)

```csharp
public abstract ValueTask WriteStateAsync(CancellationToken cancellationToken)
```

Prepares and persists an update to the journal.

### Parameters

- `cancellationToken` (`CancellationToken`): The cancellation token.

### Returns

A `System.Threading.Tasks.ValueTask` which represents the operation.
