core

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ErrMissingKeySignPairs = internal.Error("missing key-signature pairs")

ErrMissingKeySignPairs is returned by functions that expect a non-empty SignKeyPair slice, but received empty.

View Source
const ErrNilOwnerKeyContainer = internal.Error("owner-key container is nil")

ErrNilOwnerKeyContainer is returned by functions that expect a non-nil OwnerKeyContainer, but received nil.

View Source
const ErrNilOwnerKeyVerifier = internal.Error("owner-key verifier is nil")

ErrNilOwnerKeyVerifier is returned by functions that expect a non-nil OwnerKeyVerifier, but received nil.

Variables

View Source
var (
	// ErrNilFilterHandler when FilterHandler is empty
	ErrNilFilterHandler = errors.New("handler can't be nil")

	// ErrNotFound is returned by key-value storage methods
	// that could not find element by key.
	ErrNotFound = internal.Error("key not found")
)
View Source
var ErrIteratingAborted = errors.New("iteration aborted")

ErrIteratingAborted is returned by storage iterator after iteration has been interrupted.

Functions

func VerifyRequestWithSignatures

func VerifyRequestWithSignatures(req service.RequestVerifyData) error

VerifyRequestWithSignatures checks if request has signatures and all of them are valid.

Returns ErrMissingKeySignPairs if request does not have signatures. Otherwise, behaves like service.VerifyRequestData.

Types

type Bucket

type Bucket interface {
	Get(key []byte) ([]byte, error)
	Set(key, value []byte) error
	Del(key []byte) error
	Has(key []byte) bool
	Size() int64
	List() ([][]byte, error)
	Iterate(FilterHandler) error
	// Steam can be implemented by badger.Stream, but not for now
	// Stream(ctx context.Context, key []byte, cb func(io.ReadWriter) error) error
	Close() error
}

Bucket is sub-store interface

type BucketItem

type BucketItem struct {
	Key []byte
	Val []byte
}

BucketItem used in filter

func ListBucketItems

func ListBucketItems(b Bucket, h FilterHandler) ([]BucketItem, error)

ListBucketItems performs iteration over Bucket and returns the full list of its items.

type BucketType

type BucketType string

BucketType is name of bucket

const (
	// BlobStore is a blob bucket name.
	BlobStore BucketType = "blob"

	// MetaStore is a meta bucket name.
	MetaStore BucketType = "meta"

	// SpaceMetricsStore is a space metrics bucket name.
	SpaceMetricsStore BucketType = "space-metrics"
)

func (BucketType) String

func (t BucketType) String() string

type FilterHandler

type FilterHandler func(key, val []byte) bool

FilterHandler where you receive key/val in your closure

type OwnerKeyContainer

type OwnerKeyContainer interface {
	GetOwnerID() refs.OwnerID
	GetOwnerKey() []byte
}

OwnerKeyContainer is an interface of the container of owner's ID and key pair with read access.

type OwnerKeyVerifier

type OwnerKeyVerifier interface {
	// Must check if OwnerKeyContainer satisfies a certain criterion.
	// Nil error is equivalent to matching the criterion.
	VerifyKey(context.Context, OwnerKeyContainer) error
}

OwnerKeyVerifier is an interface of OwnerKeyContainer validator.

func NewNeoKeyVerifier

func NewNeoKeyVerifier() OwnerKeyVerifier

NewNeoKeyVerifier creates a new Neo owner key verifier and return a OwnerKeyVerifier interface.

type Storage

type Storage interface {
	GetBucket(name BucketType) (Bucket, error)
	Size() int64
	Close() error
}

Storage component interface

Jump to

Keyboard shortcuts

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