gcs

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromCmdlineOptions added in v0.18.0

func NewFromCmdlineOptions() plugin.Plugin

Types

type BlobStoreGCS

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

BlobStoreGCS stores data in a Google Cloud Storage bucket.

func New

func New(
	dataDir string,
	logger *slog.Logger,
	promRegistry prometheus.Registerer,
) (*BlobStoreGCS, error)

New creates a new GCS-backed blob store.

func NewWithOptions added in v0.18.0

func NewWithOptions(opts ...BlobStoreGCSOptionFunc) (*BlobStoreGCS, error)

NewWithOptions creates a new GCS-backed blob store using options.

func (*BlobStoreGCS) Bucket

func (d *BlobStoreGCS) Bucket() *storage.BucketHandle

Returns the bucket handle.

func (*BlobStoreGCS) Client

func (d *BlobStoreGCS) Client() *storage.Client

Returns the GCS client.

func (*BlobStoreGCS) Close

func (d *BlobStoreGCS) Close() error

Close closes the GCS client.

func (*BlobStoreGCS) Delete added in v0.19.0

func (d *BlobStoreGCS) Delete(txn types.Txn, key []byte) error

Delete removes a key from GCS within a transaction

func (*BlobStoreGCS) DeleteBlock added in v0.20.0

func (d *BlobStoreGCS) DeleteBlock(
	txn types.Txn,
	slot uint64,
	hash []byte,
	id uint64,
) error

DeleteBlock removes a block and its associated data

func (*BlobStoreGCS) DeleteTx added in v0.22.0

func (d *BlobStoreGCS) DeleteTx(
	txn types.Txn,
	txHash []byte,
) error

DeleteTx removes a transaction's offset data

func (*BlobStoreGCS) DeleteUtxo added in v0.20.0

func (d *BlobStoreGCS) DeleteUtxo(
	txn types.Txn,
	txId []byte,
	outputIdx uint32,
) error

DeleteUtxo removes a UTxO's data

func (*BlobStoreGCS) Get added in v0.19.0

func (d *BlobStoreGCS) Get(txn types.Txn, key []byte) ([]byte, error)

Get retrieves a value from GCS within a transaction

func (*BlobStoreGCS) GetBlock added in v0.20.0

func (d *BlobStoreGCS) GetBlock(
	txn types.Txn,
	slot uint64,
	hash []byte,
) ([]byte, types.BlockMetadata, error)

GetBlock retrieves a block's CBOR data and metadata

func (*BlobStoreGCS) GetBlockURL added in v0.22.0

func (d *BlobStoreGCS) GetBlockURL(
	ctx context.Context,
	txn types.Txn,
	point ocommon.Point,
) (types.SignedURL, types.BlockMetadata, error)

func (*BlobStoreGCS) GetCommitTimestamp

func (b *BlobStoreGCS) GetCommitTimestamp() (int64, error)

func (*BlobStoreGCS) GetTx added in v0.22.0

func (d *BlobStoreGCS) GetTx(
	txn types.Txn,
	txHash []byte,
) ([]byte, error)

GetTx retrieves a transaction's offset data

func (*BlobStoreGCS) GetUtxo added in v0.20.0

func (d *BlobStoreGCS) GetUtxo(
	txn types.Txn,
	txId []byte,
	outputIdx uint32,
) ([]byte, error)

GetUtxo retrieves a UTxO's CBOR data

func (*BlobStoreGCS) NewIterator added in v0.19.0

func (d *BlobStoreGCS) NewIterator(
	txn types.Txn,
	opts types.BlobIteratorOptions,
) types.BlobIterator

NewIterator creates an iterator for GCS within a transaction.

Important: items returned by the iterator's `Item()` must only be accessed while the transaction used to create the iterator is still active. Implementations may validate transaction state at access time (for example `ValueCopy` may fail if the transaction has been committed or rolled back). Typical usage iterates and accesses item values within the same transaction scope.

func (*BlobStoreGCS) NewTransaction added in v0.19.0

func (d *BlobStoreGCS) NewTransaction(readWrite bool) types.Txn

NewTransaction returns a lightweight transaction wrapper.

func (*BlobStoreGCS) Set added in v0.19.0

func (d *BlobStoreGCS) Set(txn types.Txn, key, val []byte) error

Set stores a key-value pair in GCS within a transaction

func (*BlobStoreGCS) SetBlock added in v0.20.0

func (d *BlobStoreGCS) SetBlock(
	txn types.Txn,
	slot uint64,
	hash []byte,
	cborData []byte,
	id uint64,
	blockType uint,
	height uint64,
	prevHash []byte,
) error

SetBlock stores a block with its metadata and index

func (*BlobStoreGCS) SetCommitTimestamp

func (b *BlobStoreGCS) SetCommitTimestamp(
	timestamp int64,
	txn types.Txn,
) error

func (*BlobStoreGCS) SetTx added in v0.22.0

func (d *BlobStoreGCS) SetTx(
	txn types.Txn,
	txHash []byte,
	offsetData []byte,
) error

SetTx stores a transaction's offset data

func (*BlobStoreGCS) SetUtxo added in v0.20.0

func (d *BlobStoreGCS) SetUtxo(
	txn types.Txn,
	txId []byte,
	outputIdx uint32,
	cborData []byte,
) error

SetUtxo stores a UTxO's CBOR data

func (*BlobStoreGCS) Start added in v0.18.0

func (d *BlobStoreGCS) Start() error

Start implements the plugin.Plugin interface.

func (*BlobStoreGCS) Stop added in v0.18.0

func (d *BlobStoreGCS) Stop() error

Stop implements the plugin.Plugin interface.

type BlobStoreGCSOptionFunc added in v0.18.0

type BlobStoreGCSOptionFunc func(*BlobStoreGCS)

func WithBucket added in v0.18.0

func WithBucket(bucket string) BlobStoreGCSOptionFunc

WithBucket specifies the GCS bucket name

func WithLogger added in v0.18.0

func WithLogger(logger *slog.Logger) BlobStoreGCSOptionFunc

WithLogger specifies the logger object to use for logging messages

func WithPromRegistry added in v0.18.0

func WithPromRegistry(
	registry prometheus.Registerer,
) BlobStoreGCSOptionFunc

WithPromRegistry specifies the prometheus registry to use for metrics

type GcsLogger

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

GcsLogger is a wrapper type to give our logger a consistent interface

func NewGcsLogger

func NewGcsLogger(logger *slog.Logger) *GcsLogger

func (*GcsLogger) Debugf

func (g *GcsLogger) Debugf(msg string, args ...any)

func (*GcsLogger) Errorf

func (g *GcsLogger) Errorf(msg string, args ...any)

func (*GcsLogger) Infof

func (g *GcsLogger) Infof(msg string, args ...any)

func (*GcsLogger) Warningf

func (g *GcsLogger) Warningf(msg string, args ...any)

Jump to

Keyboard shortcuts

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