nodestorage

package
v0.5.0-alpha.20 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 27 Imported by: 6

Documentation

Index

Constants

View Source
const (
	IndexStorageName = ".index"
)

Variables

View Source
var (
	ErrUnknownSpaceId = errors.New("unknown space id")
	ErrNoLastRecordId = errors.New("no last record id")
)
View Source
var (
	ErrClosed  = errors.New("space storage closed")
	ErrDeleted = errors.New("space storage deleted")
)
View Source
var (
	ErrLocked                  = errors.New("space storage locked")
	ErrSpaceIdIsEmpty          = errors.New("space id is empty")
	ErrDoesntSupportSpaceStats = errors.New("doesn't support nodestorage.ObjectSpaceStats")
)

Functions

This section is empty.

Types

type ChangeSizeStats added in v0.4.2

type ChangeSizeStats struct {
	MaxLen int     `json:"maxLen"`
	P95    float64 `json:"p95"`
	Avg    float64 `json:"avg"`
	Median float64 `json:"median"`
	Total  int     `json:"total"`
}

type Config

type Config struct {
	Path         string `yaml:"path"`
	AnyStorePath string `yaml:"anyStorePath"`
}

type IndexStorage added in v0.5.0

type IndexStorage interface {
	SetSpaceStatus(ctx context.Context, spaceId string, status SpaceStatus, recId string) (err error)
	SpaceStatus(ctx context.Context, spaceId string) (status SpaceStatus, err error)
	LastRecordId(ctx context.Context) (id string, err error)
	Close() (err error)
}

func OpenIndexStorage added in v0.5.0

func OpenIndexStorage(ctx context.Context, rootPath string) (ds IndexStorage, err error)

type NodeStorage

type NodeStorage interface {
	spacestorage.SpaceStorageProvider
	IndexStorage() IndexStorage
	SpaceStorage(ctx context.Context, spaceId string) (spacestorage.SpaceStorage, error)
	TryLockAndDo(ctx context.Context, spaceId string, do func() error) (err error)
	DumpStorage(ctx context.Context, id string, do func(path string) error) (err error)
	AllSpaceIds() (ids []string, err error)
	OnDeleteStorage(onDelete func(ctx context.Context, spaceId string))
	OnWriteHash(onWrite func(ctx context.Context, spaceId, hash string))
	StoreDir(spaceId string) (path string)
	DeleteSpaceStorage(ctx context.Context, spaceId string) error
	GetStats(ctx context.Context, id string, treeTop int) (spaceStats SpaceStats, err error)
}

func New

func New() NodeStorage

type NodeStorageStats added in v0.4.2

type NodeStorageStats interface {
	GetSpaceStats(ctx context.Context, treeTop int) (ObjectSpaceStats, error)
}

type ObjectSpaceStats added in v0.5.0

type ObjectSpaceStats struct {
	ObjectsCount        int             `json:"objectsCount,omitempty"`
	DeletedObjectsCount int             `json:"deletedObjectsCount"`
	ChangesCount        int             `json:"changesCount"`
	ChangeSize          ChangeSizeStats `json:"changeSizeStats,omitempty"`
	TreeStats           []TreeStat      `json:"treeStats,omitempty"`
	// contains filtered or unexported fields
}

type SpaceStats added in v0.4.2

type SpaceStats struct {
	Storage ObjectSpaceStats `json:"storage"`
	Acl     struct {
		Readers int `json:"readers"`
		Writers int `json:"writers"`
	} `json:"acl"`
}

type SpaceStatus added in v0.3.1

type SpaceStatus int
const (
	SpaceStatusOk SpaceStatus = iota
	SpaceStatusRemove
)

type StorageStat added in v0.5.0

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

type TreeStat added in v0.4.8

type TreeStat struct {
	Id                 string `json:"id"`
	ChangesCount       int    `json:"changesCount"`
	SnapshotsCount     int    `json:"snapshotsCount"`
	MaxSnapshotCounter int    `json:"maxSnapshotCounter"`
	ChangesSumSize     int    `json:"payloadSize"`
}

Directories

Path Synopsis
Package mock_nodestorage is a generated GoMock package.
Package mock_nodestorage is a generated GoMock package.

Jump to

Keyboard shortcuts

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