state

package
v1.16.25-beta001 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Get(ctx context.Context, key string) (LogState, error)
	Put(ctx context.Context, key string, state LogState) error
}

Interface for state storage - we need to know if log is pending or finished

func NewState

func NewState(kv jetstream.KeyValue) Interface

NewState creates new state storage

type LogState

type LogState byte

We need to know where to get logs from. For pending logs it'll be fetched from the buffer For completed logs they'll be fetched from the s3 bucket

const (
	LogStateUnknown  LogState = 0
	LogStatePending  LogState = 1
	LogStateFinished LogState = 2
)

type NatsKV

type NatsKV interface {
	Get(ctx context.Context, key string) (jetstream.KeyValueEntry, error)
	Put(ctx context.Context, key string, value []byte) (uint64, error)
}

KV is type implicitly interfaced from NATS

type State

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

State is a state storage based on NATS KV store

func (State) Get

func (s State) Get(ctx context.Context, key string) (LogState, error)

Get returns state for given key - executionId

func (State) Put

func (s State) Put(ctx context.Context, key string, state LogState) error

Put puts state for given key - executionId

Jump to

Keyboard shortcuts

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