client

package
v0.2.3-kustomize.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PieceStoreSuccessPut defines the metrics label of successfully put piece data
	PieceStoreSuccessPut = "put_piece_store_success"
	// PieceStoreFailurePut defines the metrics label of unsuccessfully put piece data
	PieceStoreFailurePut = "put_piece_store_failure"
	// PieceStoreSuccessGet defines the metrics label of successfully get piece data
	PieceStoreSuccessGet = "get_piece_store_success"
	// PieceStoreFailureGet defines the metrics label of unsuccessfully get piece data
	PieceStoreFailureGet = "get_piece_store_failure"
	// PieceStoreSuccessDel defines the metrics label of successfully delete piece data
	PieceStoreSuccessDel = "del_piece_store_success"
	// PieceStoreFailureDel defines the metrics label of unsuccessfully delete piece data
	PieceStoreFailureDel = "del_piece_store_failure"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PieceStoreAPI

type PieceStoreAPI interface {
	GetPiece(ctx context.Context, key string, offset, limit int64) ([]byte, error)
	PutPiece(key string, value []byte) error
}

PieceStoreAPI provides an interface to enable mocking the StoreClient's API operation. This makes unit test to test your code easier.

type StoreClient

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

func NewStoreClient

func NewStoreClient(pieceConfig *storage.PieceStoreConfig) (*StoreClient, error)

func (*StoreClient) DeletePiece added in v0.2.0

func (client *StoreClient) DeletePiece(ctx context.Context, key string) error

DeletePiece deletes piece from piece store.

func (*StoreClient) GetPiece added in v0.1.1

func (client *StoreClient) GetPiece(ctx context.Context, key string, offset, limit int64) (data []byte, err error)

GetPiece gets piece data from piece store.

func (*StoreClient) PutPiece added in v0.1.1

func (client *StoreClient) PutPiece(ctx context.Context, key string, value []byte) error

PutPiece puts piece to piece store.

Jump to

Keyboard shortcuts

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