storage

package
v0.0.0-...-ad90b1c Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWriteTimeout = errors.New("backend storage write timeout")
	ErrShutdown     = errors.New("backend storage is shut down")
)

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Put(t EntryType, entries []*Entry) error
	Get(t EntryType, keys []string) ([]*Entry, error)
	Delete(t EntryType, keys []string) error
	List(t EntryType) ([]*Entry, error)
}

type Config

type Config struct {
	Path string

	WriteTimeoutS int
	NumWorkers    int
}

type Entry

type Entry struct {
	Key   string
	Value []byte
}

type EntryType

type EntryType string
const (
	EntryTypeRole  EntryType = "role"
	EntryTypeToken EntryType = "token"
)
const (
	EntryTypeFile  EntryType = "file"
	EntryTypeBlock EntryType = "block"
)
const (
	EntryTypePolicy EntryType = "policy"
)

type FileStorageBackend

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

func NewFileStorageBackend

func NewFileStorageBackend(config Config) (*FileStorageBackend, error)

func (*FileStorageBackend) Close

func (s *FileStorageBackend) Close() error

func (*FileStorageBackend) Delete

func (s *FileStorageBackend) Delete(t EntryType, keys []string) error

func (*FileStorageBackend) Get

func (s *FileStorageBackend) Get(t EntryType, keys []string) ([]*Entry, error)

func (*FileStorageBackend) List

func (s *FileStorageBackend) List(entryType EntryType) ([]*Entry, error)

func (*FileStorageBackend) Put

func (s *FileStorageBackend) Put(t EntryType, entries []*Entry) error

type Storage

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

func NewStorage

func NewStorage(conf Config) (*Storage, error)

func (*Storage) DeleteBlocks

func (s *Storage) DeleteBlocks(blocks []*control_pb.BlockInfo) error

func (*Storage) DeleteFile

func (s *Storage) DeleteFile(file *control_pb.FileInfo) error

func (*Storage) DeleteFileWithBlocks

func (s *Storage) DeleteFileWithBlocks(file *control_pb.FileInfo) error

func (*Storage) DeletePolicy

func (s *Storage) DeletePolicy(p *control_pb.Policy) error

func (*Storage) DeleteRole

func (s *Storage) DeleteRole(role *control_pb.Role) error

func (*Storage) GetAllFiles

func (s *Storage) GetAllFiles() []*control_pb.FileInfo

func (*Storage) GetAllRoleTokens

func (s *Storage) GetAllRoleTokens(roleID string) ([]*control_pb.Token, error)

func (*Storage) GetBlocks

func (s *Storage) GetBlocks(fileID string) ([]*control_pb.BlockInfo, error)

func (*Storage) GetFile

func (s *Storage) GetFile(fileID string) (*control_pb.FileInfo, error)

func (*Storage) GetFileByPath

func (s *Storage) GetFileByPath(path string) (*control_pb.FileInfo, error)

func (*Storage) GetFilesByParentId

func (s *Storage) GetFilesByParentId(id string) ([]*control_pb.FileInfo, error)

func (*Storage) GetPolicy

func (s *Storage) GetPolicy(name string) (*control_pb.Policy, error)

func (*Storage) GetRole

func (s *Storage) GetRole(name string) (*control_pb.Role, error)

func (*Storage) GetRoleByID

func (s *Storage) GetRoleByID(roleID string) (*control_pb.Role, error)

func (*Storage) GetToken

func (s *Storage) GetToken(accessor string) (*control_pb.Token, error)

func (*Storage) ListPolicies

func (s *Storage) ListPolicies() ([]*control_pb.Policy, error)

func (*Storage) ListTokens

func (s *Storage) ListTokens() ([]*control_pb.Token, error)

func (*Storage) PutBlocks

func (s *Storage) PutBlocks(blocks []*control_pb.BlockInfo) error

func (*Storage) RevokeToken

func (s *Storage) RevokeToken(token *control_pb.Token) error

func (*Storage) SetBackend

func (s *Storage) SetBackend(backend Backend)

func (*Storage) StoreFile

func (s *Storage) StoreFile(file *control_pb.FileInfo) error

StoreFile puts file to memory and stores it to backend

func (*Storage) StorePolicy

func (s *Storage) StorePolicy(p *control_pb.Policy) error

func (*Storage) StoreRole

func (s *Storage) StoreRole(role *control_pb.Role) error

func (*Storage) StoreToken

func (s *Storage) StoreToken(token *control_pb.Token) error

Jump to

Keyboard shortcuts

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