storage

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMinioService added in v0.1.11

type IMinioService interface {
	GetMinioStat(ctx context.Context) (totalSpace, usage float64)
}

type Manager

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

Manager handles storage operations

func NewManager

func NewManager(opts *ManagerOptions) (*Manager, error)

NewManager creates a new Manager instance

func (*Manager) AddAssetToView

func (m *Manager) AddAssetToView(ctx context.Context, root cid.Cid) error

AddAssetToView adds an asset to the assets view

func (*Manager) AllocatePathWithSize added in v0.1.18

func (m *Manager) AllocatePathWithSize(size int64) (string, error)

func (*Manager) AssetCount

func (m *Manager) AssetCount() (int, error)

AssetCount returns the number of assets

func (*Manager) AssetExists

func (m *Manager) AssetExists(root cid.Cid) (bool, error)

AssetExists checks if an asset exists

func (*Manager) CloseAssetView added in v0.1.18

func (m *Manager) CloseAssetView() error

func (*Manager) DeleteAsset

func (m *Manager) DeleteAsset(root cid.Cid) error

DeleteAsset removes an asset

func (*Manager) DeletePuller

func (m *Manager) DeletePuller(c cid.Cid) error

DeletePuller removes an puller from storage

func (*Manager) GetAsset

func (m *Manager) GetAsset(root cid.Cid) (io.ReadSeekCloser, error)

GetAsset retrieves an asset

func (*Manager) GetAssetHashesForSyncData added in v0.1.16

func (m *Manager) GetAssetHashesForSyncData(ctx context.Context) ([]string, error)

func (*Manager) GetAssetsInBucket

func (m *Manager) GetAssetsInBucket(ctx context.Context, bucketID uint32) ([]cid.Cid, error)

GetAssetsInBucket retrieves the assets in a specific bucket

func (*Manager) GetBucketHashes

func (m *Manager) GetBucketHashes(ctx context.Context) (map[uint32]string, error)

GetBucketHashes retrieves the hashes for each bucket

func (*Manager) GetDiskUsageStat

func (m *Manager) GetDiskUsageStat() (totalSpace, usage float64)

GetDiskUsageStat retrieves the disk usage statistics

func (*Manager) GetFileSystemType

func (m *Manager) GetFileSystemType() string

GetFileSystemType retrieves the type of the file system

func (*Manager) GetPuller

func (m *Manager) GetPuller(c cid.Cid) ([]byte, error)

GetPuller retrieves puller from storage

func (*Manager) GetTopHash

func (m *Manager) GetTopHash(ctx context.Context) (string, error)

AssetsView API GetTopHash retrieves the top hash of assets

func (*Manager) GetWaitList

func (m *Manager) GetWaitList() ([]byte, error)

GetWaitList retrieves the waitlist data

func (*Manager) PullerExists

func (m *Manager) PullerExists(c cid.Cid) (bool, error)

PullerExists checks if an puller exist in storage

func (*Manager) RemoveAssetFromView

func (m *Manager) RemoveAssetFromView(ctx context.Context, root cid.Cid) error

RemoveAssetFromView removes an asset from the assets view

func (*Manager) StoreBlocks

func (m *Manager) StoreBlocks(ctx context.Context, root cid.Cid, blks []blocks.Block) error

asset api StoreBlocks stores multiple blocks for an asset

func (*Manager) StoreBlocksToCar added in v0.1.10

func (m *Manager) StoreBlocksToCar(ctx context.Context, root cid.Cid) error

StoreBlocksToCar stores a single asset

func (*Manager) StorePuller

func (m *Manager) StorePuller(c cid.Cid, data []byte) error

StorePuller stores puller data in storage

func (*Manager) StoreUserAsset added in v0.1.13

func (m *Manager) StoreUserAsset(ctx context.Context, userID string, root cid.Cid, assetSize int64, r io.Reader) error

func (*Manager) StoreWaitList

func (m *Manager) StoreWaitList(data []byte) error

StoreWaitList stores the waitlist data

type ManagerOptions

type ManagerOptions struct {
	MetaDataPath string
	AssetsPaths  []string
	MinioConfig  *config.MinioConfig
	SchedulerAPI api.Scheduler
}

ManagerOptions contains configuration options for the Manager

type Storage

type Storage interface {
	StorePuller(c cid.Cid, data []byte) error
	GetPuller(c cid.Cid) ([]byte, error)
	PullerExists(c cid.Cid) (bool, error)
	DeletePuller(c cid.Cid) error

	StoreBlocks(ctx context.Context, root cid.Cid, blks []blocks.Block) error

	AllocatePathWithSize(size int64) (string, error)
	StoreBlocksToCar(ctx context.Context, root cid.Cid) error
	StoreUserAsset(ctx context.Context, userID string, root cid.Cid, assetSize int64, r io.Reader) error
	GetAsset(root cid.Cid) (io.ReadSeekCloser, error)
	GetAssetHashesForSyncData(ctx context.Context) ([]string, error)
	AssetExists(root cid.Cid) (bool, error)
	DeleteAsset(root cid.Cid) error
	AssetCount() (int, error)

	// assets view
	GetTopHash(ctx context.Context) (string, error)
	GetBucketHashes(ctx context.Context) (map[uint32]string, error)
	GetAssetsInBucket(ctx context.Context, bucketID uint32) ([]cid.Cid, error)
	AddAssetToView(ctx context.Context, root cid.Cid) error
	RemoveAssetFromView(ctx context.Context, root cid.Cid) error
	CloseAssetView() error

	StoreWaitList(data []byte) error
	GetWaitList() ([]byte, error)

	GetDiskUsageStat() (totalSpace, usage float64)
	GetFileSystemType() string
}

Storage is an interface for handling storage operations related to assets.

Jump to

Keyboard shortcuts

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