registry

package
v0.0.0-...-76fd5c9 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SelectorAwaiting waits for a new item to arrive.
	// This selector visits each item exactly once and can be used when items
	// to select are being pushed into registry concurrently.
	SelectorAwaiting = iota
	// SelectorLooped rewinds cursor to the start after all items have been read.
	// It can encounter duplicates and should be used mostly for read scenarious.
	SelectorLooped
	// SelectorOneshot visits each item exactly once and exits immediately afterwards.
	// It may be used to artificially abort the test after all items were processed.
	SelectorOneshot
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjExporter

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

func NewObjExporter

func NewObjExporter(selector *ObjSelector) *ObjExporter

func (*ObjExporter) ExportJSONPreGen

func (o *ObjExporter) ExportJSONPreGen(fileName string) error

type ObjFilter

type ObjFilter struct {
	Status string
	Age    int
}

type ObjInfo

type ObjInfo struct {
	Bucket string `json:"bucket"`
	Object string `json:"object"`
	CID    string `json:"cid"`
	OID    string `json:"oid"`
}

type ObjRegistry

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

func NewObjRegistry

func NewObjRegistry(ctx context.Context, dbFilePath string) *ObjRegistry

NewObjRegistry creates a new instance of object registry that stores information about objects in the specified bolt database. As registry uses read-write connection to the database, there may be only one instance of object registry per database file at a time.

func (*ObjRegistry) AddObject

func (o *ObjRegistry) AddObject(cid, oid, s3Bucket, s3Key, payloadHash string) error

func (*ObjRegistry) Close

func (o *ObjRegistry) Close() error

func (*ObjRegistry) DeleteObject

func (o *ObjRegistry) DeleteObject(id uint64) error

func (*ObjRegistry) SetObjectStatus

func (o *ObjRegistry) SetObjectStatus(id uint64, oldStatus, newStatus string) error

type ObjSelector

type ObjSelector struct {

	// Sync synchronizes VU used for deletion.
	Sync sync.WaitGroup
	// contains filtered or unexported fields
}

func NewObjSelector

func NewObjSelector(registry *ObjRegistry, selectionSize int, kind SelectorKind, filter *ObjFilter) *ObjSelector

NewObjSelector creates a new instance of object selector that can iterate over objects in the specified registry.

func (*ObjSelector) Count

func (o *ObjSelector) Count() (int, error)

Count returns total number of objects that match filter of the selector.

func (*ObjSelector) NextObject

func (o *ObjSelector) NextObject() *ObjectInfo

NextObject returns the next object from the registry that matches filter of the selector. NextObject only roams forward from the current position of the selector. If there are no objects that match the filter, blocks until one of the following happens:

  • a "new" next object is available;
  • underlying registry context is done, nil objects will be returned on the currently blocked and every further NextObject calls.

type ObjectInfo

type ObjectInfo struct {
	Id          uint64 // Identifier in bolt DB
	CreatedAt   int64  // UTC seconds from epoch when the object was created
	CID         string // Container ID in gRPC/HTTP
	OID         string // Object ID in gRPC/HTTP
	S3Bucket    string // Bucket name in S3
	S3Key       string // Object key in S3
	Status      string // Status of the object
	PayloadHash string // SHA256 hash of object payload that can be used for verification
}

ObjectInfo represents information about FrostFS object that has been created via gRPC/HTTP/S3 API.

func (*ObjectInfo) DecodeBinary

func (o *ObjectInfo) DecodeBinary(r *io.BinReader)

func (ObjectInfo) EncodeBinary

func (o ObjectInfo) EncodeBinary(w *io.BinWriter)

func (ObjectInfo) Marshal

func (o ObjectInfo) Marshal() ([]byte, error)

func (*ObjectInfo) Unmarshal

func (o *ObjectInfo) Unmarshal(data []byte) error

type PreGenerateInfo

type PreGenerateInfo struct {
	Buckets    []string  `json:"buckets"`
	Containers []string  `json:"containers"`
	Objects    []ObjInfo `json:"objects"`
	ObjSize    string    `json:"obj_size"`
}

type Registry

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

Registry represents an instance of the module for every VU.

func (*Registry) Exports

func (r *Registry) Exports() modules.Exports

Exports implements the modules.Instance interface and returns the exports of the JS module.

func (*Registry) GetExporter

func (r *Registry) GetExporter(selector *ObjSelector) *ObjExporter

func (*Registry) GetLoopedSelector

func (r *Registry) GetLoopedSelector(dbFilePath string, name string, cacheSize int, filter map[string]string) *ObjSelector

func (*Registry) GetOneshotSelector

func (r *Registry) GetOneshotSelector(dbFilePath string, name string, cacheSize int, filter map[string]string) *ObjSelector

func (*Registry) GetSelector

func (r *Registry) GetSelector(dbFilePath string, name string, cacheSize int, filter map[string]string) *ObjSelector

func (*Registry) Open

func (r *Registry) Open(dbFilePath string) *ObjRegistry

Open creates a new instance of object registry that will store information about objects in the specified file. If repository instance for the file was previously created, then Open will return the existing instance of repository, because bolt database allows only one write connection at a time.

type RootModule

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

RootModule is the global module object type. It is instantiated once per test run and will be used to create k6/x/frostfs/registry module instances for each VU.

func (*RootModule) NewModuleInstance

func (r *RootModule) NewModuleInstance(vu modules.VU) modules.Instance

NewModuleInstance implements the modules.Module interface and returns a new instance for each VU.

type SelectorKind

type SelectorKind byte

SelectorKind represents selector behaviour when no items are available.

Jump to

Keyboard shortcuts

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