Help us shape the future of Go! Take the 2026 Go Developer Survey

state

package
v0.0.37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryState

type InMemoryState struct {
	// contains filtered or unexported fields
}

InMemoryState is an implementation of our state that lives only in memory.

func NewInMemoryState

func NewInMemoryState() *InMemoryState

NewInMemoryState returns a new InMemoryState.

func (*InMemoryState) AppendOperationEvent

func (i *InMemoryState) AppendOperationEvent(event *pb.Operation_Event) error

AppendOperationEvent takes an operation event and appends it into the operations event history.

func (*InMemoryState) GetOperationEvents

func (i *InMemoryState) GetOperationEvents(
	ref *pb.Ref_Operation,
) (
	[]*pb.Operation_Event,
	error,
)

GetOperationEvents takes a reference to an operation and returns the entire event history.

func (*InMemoryState) GetOperationResponse

func (i *InMemoryState) GetOperationResponse(
	ref *pb.Ref_Operation,
) (
	*pb.Operation_Response,
	error,
)

GetOperationResponse takes a reference to an operation and returns the most recent response.

func (*InMemoryState) UpsertOperationResponse

func (i *InMemoryState) UpsertOperationResponse(res *pb.Operation_Response) error

UpsertOperationResponse takes and operation response and updates or inserts it into the response history.

type State

type State interface {
	// GetOperationResponse returns the most recent committed operation response.
	GetOperationResponse(ref *pb.Ref_Operation) (*pb.Operation_Response, error)
	// UpsertOperationResponse updates or inserts the operation response.
	UpsertOperationResponse(res *pb.Operation_Response) error
	// GetOperationEvents returns an event history for the operation
	GetOperationEvents(ref *pb.Ref_Operation) ([]*pb.Operation_Event, error)
	// AppendOperationEvent appends an event into the operation event history
	AppendOperationEvent(ev *pb.Operation_Event) error
}

State is our server state.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL