memstore

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPruneInterval = 500 * time.Millisecond
	BytesPerFieldElement = 32
)

Variables

View Source
var (
	EnabledFlagName                 = withFlagPrefix("enabled")
	ExpirationFlagName              = withFlagPrefix("expiration")
	PutLatencyFlagName              = withFlagPrefix("put-latency")
	GetLatencyFlagName              = withFlagPrefix("get-latency")
	PutReturnsFailoverErrorFlagName = withFlagPrefix("put-returns-failover-error")
)

Functions

func CLIFlags

func CLIFlags(envPrefix, category string) []cli.Flag

CLIFlags ... used for memstore backend configuration category is used to group the flags in the help output (see https://cli.urfave.org/v2/examples/flags/#grouping)

Types

type Config

type Config struct {
	MaxBlobSizeBytes uint64
	BlobExpiration   time.Duration
	// TODO: we should probably add an admin api to set the below values
	//       without having to restart the server
	// artificial latency added for memstore backend to mimic eigenda's latency
	PutLatency time.Duration
	GetLatency time.Duration
	// when true, put requests will return an errorFailover error,
	// after sleeping PutLatency duration.
	// This can be used to simulate eigenda being down.
	PutReturnsFailoverError bool
}

func ReadConfig

func ReadConfig(ctx *cli.Context) Config

type MemStore

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

MemStore is a simple in-memory store for blobs which uses an expiration time to evict blobs to best emulate the ephemeral nature of blobs dispersed to EigenDA operators.

func New

func New(
	ctx context.Context, verifier *verify.Verifier, log logging.Logger, config Config,
) (*MemStore, error)

New ... constructor

func (*MemStore) BackendType

func (e *MemStore) BackendType() common.BackendType

func (*MemStore) Get

func (e *MemStore) Get(_ context.Context, commit []byte) ([]byte, error)

Get fetches a value from the store.

func (*MemStore) Put

func (e *MemStore) Put(_ context.Context, value []byte) ([]byte, error)

Put inserts a value into the store.

func (*MemStore) Verify

func (e *MemStore) Verify(_ context.Context, _, _ []byte) error

Jump to

Keyboard shortcuts

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