interfaces

package
v0.0.0-...-ca3ac9b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OpUnknown = OperationType{/* contains filtered or unexported fields */}
	OpBackup  = OperationType{/* contains filtered or unexported fields */}
	OpTntBck  = OperationType{/* contains filtered or unexported fields */}
	OpRestore = OperationType{/* contains filtered or unexported fields */}
	OpCache   = OperationType{/* contains filtered or unexported fields */}
)

defining different operations

View Source
var (
	ErrOperationUnknown = errors.New("operation is unknown")
)

ErrOperationUnknown if a string can't be converted into an operation

Functions

This section is empty.

Types

type BlobStorage

type BlobStorage interface {
	Init() error       // initialize this service
	GetTenant() string // get the tenant id

	GetBlobs(callback func(id string) bool) error // getting a list of blob from the storage

	// CRUD operation on the blob files
	StoreBlob(b *model.BlobDescription, r io.Reader) (string, error) // storing a blob to the storage system
	HasBlob(id string) (bool, error)                                 // checking, if a blob is present
	GetBlobDescription(id string) (*model.BlobDescription, error)    // getting the description of the file
	UpdateBlobDescription(id string, b *model.BlobDescription) error // updating the blob description
	RetrieveBlob(id string, w io.Writer) error                       // retrieving the binary data from the storage system
	DeleteBlob(id string) error                                      // removing a blob from the storage system
	CheckBlob(id string) (*model.CheckInfo, error)                   // checking a single blob from the storage system

	// Searching for blobs
	SearchBlobs(query string, callback func(id string) bool) error // getting a list of blob from the storage

	// Retention related methods
	GetAllRetentions(callback func(r model.RetentionEntry) bool) error // for every retention entry for this tenant we call this this function, you can stop the listing by returnong a false
	AddRetention(r *model.RetentionEntry) error
	GetRetention(id string) (model.RetentionEntry, error)
	DeleteRetention(id string) error
	ResetRetention(id string) error

	GetLastError() error // getting the last error

	Close() error // closing the storage
}

BlobStorage this is the interface which all implementation of a blob storage engine has to fulfill

type Callback

type Callback func(op Operation) bool

Callback used by the coordinator

type Index

type Index interface {
	Init() error                                              // initialize the indexer
	Search(query string, callback func(id string) bool) error // getting a list of blob from the storage
	Index(id string, b model.BlobDescription) error           // index a single blob description
	NewBatch() IndexBatch                                     // returning a index batch processor
}

Index interface for indexer

type IndexBatch

type IndexBatch interface {
	Add(id string, b model.BlobDescription) error // add a single blob description to this batch
	Index() error                                 // index all added description in one batch and empty this batch
}

IndexBatch interface batch index

type Operation

type Operation interface {
	Type() OperationType
	Started() bool
	Active() bool
	Finished() bool
	ID() string
}

Operation this is the interface for a single operation

type OperationType

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

OperationType Defining the different operations

func OpFromString

func OpFromString(s string) (OperationType, error)

OpFromString converts a string into an operation

func (*OperationType) String

func (o *OperationType) String() string

String convert to string

type OpsCoor

type OpsCoor interface {
	// Prepare get's back an operation entity, bool = true is that this operation can be started, async or sync,
	// false means there is no need to start this operation
	Prepare(op OperationType, id string, f Callback) (Operation, bool, error)
	Count(id string) int
}

OpsCoor interface for the operation coordinator

type RetentionManager

type RetentionManager interface {
	Init(stgf StorageFactory) error

	GetAllRetentions(tenant string, callback func(r model.RetentionEntry) bool) error
	AddRetention(tenant string, r *model.RetentionEntry) error
	DeleteRetention(tenant string, id string) error
	ResetRetention(tenant string, id string) error

	Close() error
}

RetentionManager interface for retention manager

type Running

type Running interface {
	IsRunning() bool
}

Running interface

type StorageFactory

type StorageFactory interface {
	Init(storage config.Engine, rtnm RetentionManager) error
	GetStorage(tenant string) (BlobStorage, error)
	RemoveStorage(tenant string) error
	Close() error
}

StorageFactory this is the interface for the factory which will create tenant specific storage implementations

type TenantConfig

type TenantConfig struct {
	Backup     config.Storage `yaml:"backup" json:"backup"`
	Properties map[string]any `yaml:"properties" json:"properties"`
}

TenantConfig config for the tenant

type TenantManager

type TenantManager interface {
	Init() error // initialize this service

	GetTenants(callback func(tenant string) bool) error // walk thru all configured tenants and get the id back

	AddTenant(tenant string) error              // adding a new tenant
	RemoveTenant(tenant string) (string, error) // removing a tenant, deleting all data async, return the processid for this
	HasTenant(tenant string) bool               // checking if a tenant is present

	SetConfig(tenant string, cnfg TenantConfig) error // setting a new config object
	GetConfig(tenant string) (*TenantConfig, error)   // getting the config object

	GetSize(tenant string) int64       // getting the overall storage size for this tenant, if tenant not present -1 is returned
	AddSize(tenant string, size int64) // adding the blob size to the tenant storage
	SubSize(tenant string, size int64) // adding the blob size to the tenant storage
	Close() error                      // closing the service
}

TenantManager is the part of the service which will administrate the tenant part of a storage system

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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