storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrConfigDoesNotExist means that config file is not available on our storage
	ErrConfigDoesNotExist = exterr.NewErrorWithMessage("config does not exist").WithComponent(app.ComponentStorage).WithCode(logStorageConfigDoesNotExistCode)
)

Functions

This section is empty.

Types

type ArchiveHeader

type ArchiveHeader struct {
	Header      *tar.Header
	ContentPath string
}

type Archiver

type Archiver interface {
	GetFileContent(ctx context.Context, source string) ([]byte, error)
	SaveArchiveFile(ctx context.Context, header *tar.Header, archive *tar.Reader, archivePath string) error
}

Archiver contains methods required while creating/saving an archive

type ModelReader

type ModelReader interface {
	ReadConfig(ctx context.Context, team, project string) ([]byte, error)
	ReadModel(ctx context.Context, modelID app.ServableID, version int) ([]ArchiveHeader, error)
	ReadAllModels(ctx context.Context, modelID app.ServableID) ([]ArchiveHeader, error)
	DirectoryLayout(path string) ([]string, error)
}

ModelReader contains all read operations required by storage

type ModelRemover

type ModelRemover interface {
	RemoveModel(ctx context.Context, id app.ServableID, version int) error
}

ModelRemover contains all remove operations required by storage

type ModelStorage

type ModelStorage interface {
	Archiver
	ModelReader
	ModelWriter
	ModelRemover
}

ModelStorage represents all interfaces used by storage while processing models

type ModelWriter

type ModelWriter interface {
	SaveConfig(ctx context.Context, team, project string, config []byte) error
	SaveModel(ctx context.Context, archivePath string, modelID app.ServableID, version int) error
	SaveIncomingModelArchive(modelID app.ServableID, archive io.Reader) (string, error)
}

ModelWriter contains all write operations required by storage

type ModelsStorage

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

ModelsStorage represents all interfaces used while read/write models to a storage

func NewModelsStorage

func NewModelsStorage(storageImplementation ModelStorage) *ModelsStorage

NewModelsStorage returns new instance of ModelsStorage

func (*ModelsStorage) ReadAllModels

func (m *ModelsStorage) ReadAllModels(ctx context.Context, modelID app.ServableID) ([]byte, error)

ReadAllModels gets archived bytes stream of model for given ServableID inside archive we got all versions of model

func (*ModelsStorage) ReadConfig

func (m *ModelsStorage) ReadConfig(ctx context.Context, team, project string) ([]byte, error)

ReadConfig gets bytes stream of config file depends on given teamm and project

func (*ModelsStorage) ReadModel

func (m *ModelsStorage) ReadModel(ctx context.Context, modelID app.ServableID, version int) ([]byte, error)

ReadModel gets archived bytes stream of model for given ServableID and model version

func (*ModelsStorage) RemoveModel

func (m *ModelsStorage) RemoveModel(ctx context.Context, id app.ServableID, version int64) error

RemoveModel removes a model based on given ServableID and model version

func (*ModelsStorage) SaveConfig

func (m *ModelsStorage) SaveConfig(ctx context.Context, team, project string, config []byte) error

SaveConfig saves given config under valid location based on team and project parammeters

func (*ModelsStorage) SaveModel

func (m *ModelsStorage) SaveModel(ctx context.Context, modelID app.ServableID, version int, archive io.Reader) (*SaveModelResponse, error)

type ModuleReader

type ModuleReader interface {
	ReadModule(ctx context.Context, moduleID app.ServableID, version int) ([]ArchiveHeader, error)
	DirectoryLayout(path string) ([]string, error)
}

ModuleReader contains all read operations required by storage

type ModuleRemover

type ModuleRemover interface {
	RemoveModule(ctx context.Context, id app.ServableID, version int64) error
}

ModuleRemover contains all remove operations required by storage

type ModuleStorage

type ModuleStorage interface {
	Archiver
	ModuleReader
	ModuleWriter
	ModuleRemover
}

ModuleStorage represents all interfaces used by storage while processing modules

type ModuleWriter

type ModuleWriter interface {
	SaveModule(ctx context.Context, archivePath string, moduleID app.ServableID, version int) error
	SaveIncomingModuleArchive(moduleID app.ServableID, archive io.Reader) (string, error)
}

ModuleWriter contains all write operations required by storage

type ModulesStorage

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

ModulesStorage represents all interfaces used while read/write modules to a storage

func NewModuleStorage

func NewModuleStorage(storageImplementation ModuleStorage) *ModulesStorage

NewModuleStorage returns new instance of ModulesStorage

func (*ModulesStorage) ReadModule

func (m *ModulesStorage) ReadModule(ctx context.Context, moduleID app.ServableID, version int) ([]byte, error)

ReadModule gets archived bytes stream of module for given ServableID and module version

func (*ModulesStorage) RemoveModule

func (m *ModulesStorage) RemoveModule(ctx context.Context, id app.ServableID, version int64) error

RemoveModule removes a module based on given ServableID and module version

func (*ModulesStorage) SaveModule

func (m *ModulesStorage) SaveModule(ctx context.Context, moduleID app.ServableID, version int, archive io.Reader) error

type SaveModelResponse

type SaveModelResponse struct {
	Config []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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