device

package
v0.0.0-...-9eadeab Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TestDeviceScheme – in-memory device used for testing. The only URL: test://
	TestDeviceScheme = "test"

	// SimpleStorageScheme – scheme for simple remote storages. Usage: storage://random_tenant_id@hostname:port. default port is 26060
	SimpleStorageScheme      = "storage"
	SimpleStorageDefaultPort = 26060

	// AbuseDeviceScheme - device that requests the API for providing device that matches parameters
	AbuseDeviceScheme = "abuse"
)

Schemes

Variables

This section is empty.

Functions

This section is empty.

Types

type CreationConfig

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

type Device

type Device interface {
	Read(ext models.Extent, buf []byte) error
	Write(writes []models.Write) error
	GetSize() int64
}

func GetDevice

func GetDevice(URL string, options ...Option) (Device, error)

type Option

type Option func(cfg *CreationConfig)

func WithRequestTimeout

func WithRequestTimeout(d time.Duration) Option

func WithSize

func WithSize(size int64) Option

type Simple

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

func NewSimple

func NewSimple(connStr string, tenantID string, cfg CreationConfig) (*Simple, error)

func (Simple) GetSize

func (s Simple) GetSize() int64

func (Simple) Read

func (s Simple) Read(ext models.Extent, buf []byte) error

func (Simple) Write

func (s Simple) Write(writes []models.Write) error

type Test

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

func NewTestDevice

func NewTestDevice(cfg CreationConfig) *Test

func (*Test) GetSize

func (s *Test) GetSize() int64

func (*Test) Read

func (s *Test) Read(ext models.Extent, buf []byte) error

func (*Test) Write

func (s *Test) Write(writes []models.Write) error

Jump to

Keyboard shortcuts

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