backend

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownStorageTypes = make(map[string]types.StorageClient)

KnownStorageTypes map storage types to storage clients before starting the server so backend knows what's supported

Functions

func DeleteState

func DeleteState(metadata *types.RequestMetadata, storageClient types.StorageClient) error

DeleteState deleting state from the storage. This is a write operation, so it's checking if the state was previously locked by a requestor.

func GetState

func GetState(metadata *types.RequestMetadata, storageClient types.StorageClient) ([]byte, error)

GetState attempt to read the state from storage. Clinet implementations must return NoErrStateDidNotExisted if the state did not existed.

func GetStorageClient

func GetStorageClient(metadata *types.RequestMetadata) (types.StorageClient, error)

GetStorageClient initialize and return a StorageClient.

func LockState

func LockState(metadata *types.RequestMetadata, storageClient types.StorageClient, body []byte) error

LockState will lock the state as requested. Locking must be atomic operation so leave all checks for the client. Client implementations must return ErrLockingConflict if it was already locked by someone else.

func ParseMetadata

func ParseMetadata(request *http.Request) (*types.RequestMetadata, error)

ParseMetadata look into the request and read metadata

func UnLockState

func UnLockState(metadata *types.RequestMetadata, storageClient types.StorageClient, body []byte) error

UnLockState will unlock the state as requested.

func UpdateState

func UpdateState(metadata *types.RequestMetadata, storageClient types.StorageClient, body []byte) error

UpdateState create or update existing state. This is a write operation, so it's checking if the state was previously locked by a requestor.

Types

This section is empty.

Jump to

Keyboard shortcuts

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