protocol

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const ETCD_DB_PREFIX = "s5-db"

Variables

This section is empty.

Functions

func GetStorageProtocol

func GetStorageProtocol(obj any) core.StorageProtocol

Types

type CacheConfig

type CacheConfig struct {
	Type         string `mapstructure:"type"`
	LRUCacheSize int    `mapstructure:"lru_cache_size"`
}

func (CacheConfig) Defaults

func (c CacheConfig) Defaults() map[string]any

func (CacheConfig) Validate

func (c CacheConfig) Validate() error

type Config

type Config struct {
	*s5config.NodeConfig `mapstructure:",squash"`
	Db                   DbConfig `mapstructure:"db"`
	TUSLockerMode        string   `mapstructure:"tus_locker_mode"`
}

func (Config) Defaults

func (c Config) Defaults() map[string]any

func (Config) Validate

func (c Config) Validate() error

type CtxRangeKeyType

type CtxRangeKeyType string
const CtxRangeKey CtxRangeKeyType = "range"

type DbConfig

type DbConfig struct {
	Type   string      `mapstructure:"type"`
	DbPath string      `mapstructure:"db_path,omitempty"`
	Cache  CacheConfig `mapstructure:"cache"`
}

func (DbConfig) Defaults

func (d DbConfig) Defaults() map[string]any

func (DbConfig) Validate

func (d DbConfig) Validate() error

type DbLocker

type DbLocker struct {
	AcquirerPollInterval time.Duration
	HolderPollInterval   time.Duration
	// contains filtered or unexported fields
}

func NewDbLocker

func NewDbLocker(db *gorm.DB, logger *core.Logger) *DbLocker

func (*DbLocker) NewLock

func (m *DbLocker) NewLock(id string) (handler.Lock, error)

type Lock

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

func (*Lock) Lock

func (l *Lock) Lock(ctx context.Context, requestUnlock func()) error

func (*Lock) Unlock

func (l *Lock) Unlock() error

type S5Protocol

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

func NewS5Protocol

func NewS5Protocol() (*S5Protocol, []core.ContextBuilderOption, error)

func (*S5Protocol) Config

func (s *S5Protocol) Config() config.ProtocolConfig

func (*S5Protocol) EncodeFileName

func (s *S5Protocol) EncodeFileName(bytes []byte) string

func (*S5Protocol) HashFromIdentifier

func (s *S5Protocol) HashFromIdentifier(identifier string) ([]byte, error)

func (*S5Protocol) Name

func (s *S5Protocol) Name() string

func (*S5Protocol) Node

func (s *S5Protocol) Node() *s5node.Node

func (*S5Protocol) Start

func (s *S5Protocol) Start(ctx core.Context) error

func (*S5Protocol) Stop

func (s *S5Protocol) Stop(ctx core.Context) error

func (*S5Protocol) StorageProtocol

func (s *S5Protocol) StorageProtocol() core.StorageProtocol

func (*S5Protocol) TusHandler

func (s *S5Protocol) TusHandler() *TusHandler

func (*S5Protocol) ValidIdentifier

func (s *S5Protocol) ValidIdentifier(identifier string) bool

type S5ProviderStore

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

func NewS5ProviderStore

func NewS5ProviderStore(ctx core.Context, tus *TusHandler) *S5ProviderStore

func (S5ProviderStore) CanProvide

func (s S5ProviderStore) CanProvide(hash *encoding.Multihash, kind []types.StorageLocationType) bool

func (S5ProviderStore) Provide

type TusHandler

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

func NewTusHandler

func NewTusHandler() (*TusHandler, []core.ContextBuilderOption)

func (*TusHandler) CreateUpload

func (t *TusHandler) CreateUpload(ctx context.Context, hash []byte, uploadID string, uploaderID uint, uploaderIP string, protocol string, mimeType string) (*models.TusUpload, error)

func (*TusHandler) DeleteUpload

func (t *TusHandler) DeleteUpload(ctx context.Context, uploadID string) error

func (*TusHandler) GetUploadReader

func (t *TusHandler) GetUploadReader(ctx context.Context, hash []byte, start int64) (io.ReadCloser, error)

func (*TusHandler) GetUploadSize

func (t *TusHandler) GetUploadSize(ctx context.Context, hash []byte) (int64, error)

func (*TusHandler) Init

func (t *TusHandler) Init() error

func (*TusHandler) S3Client

func (t *TusHandler) S3Client() *s3.Client

func (*TusHandler) ScheduleUpload

func (t *TusHandler) ScheduleUpload(ctx context.Context, uploadID string) error

func (*TusHandler) SetStorageProtocol

func (t *TusHandler) SetStorageProtocol(storageProtocol core.StorageProtocol)

func (*TusHandler) Tus

func (t *TusHandler) Tus() *handler.Handler

func (*TusHandler) TusStore

func (t *TusHandler) TusStore() handler.DataStore

func (*TusHandler) UploadCompleted

func (t *TusHandler) UploadCompleted(ctx context.Context, uploadID string) error

func (*TusHandler) UploadExists

func (t *TusHandler) UploadExists(ctx context.Context, id string) (bool, models.TusUpload)

func (*TusHandler) UploadHashExists

func (t *TusHandler) UploadHashExists(ctx context.Context, hash []byte) (bool, models.TusUpload)

func (*TusHandler) UploadProgress

func (t *TusHandler) UploadProgress(ctx context.Context, uploadID string) error

func (*TusHandler) Uploads

func (t *TusHandler) Uploads(ctx context.Context, uploaderID uint) ([]models.TusUpload, error)

Jump to

Keyboard shortcuts

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