# IStateMachine Methods

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

## OnRecoveryCompleted {#onrecoverycompleted-ec2ecfb4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.istatemachine/methods/onrecoverycompleted-ec2ecfb4/)

[Source](https://github.com/dotnet/orleans/blob/8efd4352592e66dffd235c823bfb83ecb3945320/src/Orleans.Journaling/IStateMachine.cs#L68)

```csharp
public virtual void OnRecoveryCompleted()
```

Notifies the state that all prior journal entries and snapshots have been applied.

## OnWriteCompleted {#onwritecompleted-5ee0375e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.istatemachine/methods/onwritecompleted-5ee0375e/)

[Source](https://github.com/dotnet/orleans/blob/8efd4352592e66dffd235c823bfb83ecb3945320/src/Orleans.Journaling/IStateMachine.cs#L85)

```csharp
public virtual void OnWriteCompleted()
```

Notifies the state that all prior journal entries and snapshots which it has written have been written to stable storage.

## ReplayEntry(JournalEntry, JournalReplayContext) {#replayentry-orleans-journaling-journalentry-orleans-journaling-journalreplaycont-e75261c2}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.istatemachine/methods/replayentry-orleans-journaling-journalentry-orleans-journaling-journalreplaycont-e75261c2/)

```csharp
public abstract void ReplayEntry(JournalEntry entry, JournalReplayContext context)
```

Replays one entry during journal recovery.

### Parameters

- `entry` (`JournalEntry`): The entry to replay.
- `context` (`JournalReplayContext`): The replay context.

## Reset(JournalStreamWriter) {#reset-orleans-journaling-journalstreamwriter-a0cda5c6}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.istatemachine/methods/reset-orleans-journaling-journalstreamwriter-a0cda5c6/)

```csharp
public abstract void Reset(JournalStreamWriter writer)
```

Resets the state.

### Parameters

- `writer` (`JournalStreamWriter`)

## WritePendingEntries(JournalStreamWriter) {#writependingentries-orleans-journaling-journalstreamwriter-0b8cb41b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.istatemachine/methods/writependingentries-orleans-journaling-journalstreamwriter-0b8cb41b/)

```csharp
public abstract void WritePendingEntries(JournalStreamWriter writer)
```

Writes pending state changes to the journal.

### Parameters

- `writer` (`JournalStreamWriter`): The journal stream writer.

## WriteSnapshot(JournalStreamWriter) {#writesnapshot-orleans-journaling-journalstreamwriter-f5c11b06}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.istatemachine/methods/writesnapshot-orleans-journaling-journalstreamwriter-f5c11b06/)

```csharp
public abstract void WriteSnapshot(JournalStreamWriter writer)
```

Writes a snapshot of the state to the provided writer.

### Parameters

- `writer` (`JournalStreamWriter`): The journal stream writer.
