Documentation ¶
Index ¶
- Variables
- func PathFromData(address *am.ScanGroupAddress, name string) string
- func ShardName(name string) (string, error)
- type LocalStorage
- func (s *LocalStorage) GetInfraFile(ctx context.Context, pathName, objectName string) ([]byte, error)
- func (s *LocalStorage) Init() error
- func (s *LocalStorage) PutInfraFile(ctx context.Context, pathName, objectName string, data []byte) error
- func (s *LocalStorage) Write(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, ...) (string, string, error)
- func (s *LocalStorage) WriteWithHash(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, ...) (string, error)
- type S3Storage
- func (s *S3Storage) GetInfraFile(ctx context.Context, bucketName, objectName string) ([]byte, error)
- func (s *S3Storage) Init() error
- func (s *S3Storage) PutInfraFile(ctx context.Context, bucketName, objectName string, data []byte) error
- func (s *S3Storage) Write(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, ...) (string, string, error)
- func (s *S3Storage) WriteWithHash(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, ...) (string, error)
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNameTooSmall = errors.New("name length must be greater than 5")
)
Functions ¶
func PathFromData ¶
func PathFromData(address *am.ScanGroupAddress, name string) string
PathFromData takes in an address and raw bytes to create a hashed / sharded path name
Types ¶
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
func NewLocalStorage ¶
func NewLocalStorage() *LocalStorage
func (*LocalStorage) GetInfraFile ¶
func (*LocalStorage) Init ¶
func (s *LocalStorage) Init() error
func (*LocalStorage) PutInfraFile ¶
func (*LocalStorage) Write ¶
func (s *LocalStorage) Write(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, data []byte) (string, string, error)
Writes the data to local storage, returning the hash and link/path
func (*LocalStorage) WriteWithHash ¶
func (s *LocalStorage) WriteWithHash(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, data []byte, hashName string) (string, error)
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
func NewS3Storage ¶
func (*S3Storage) GetInfraFile ¶
func (*S3Storage) PutInfraFile ¶
func (*S3Storage) WriteWithHash ¶
type Storage ¶
type Storage interface { Init() error Write(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, data []byte) (string, string, error) WriteWithHash(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, data []byte, hash string) (string, error) GetInfraFile(ctx context.Context, pathName, objectName string) ([]byte, error) PutInfraFile(ctx context.Context, pathName, objectName string, data []byte) error }
func NewStorage ¶
Click to show internal directories.
Click to hide internal directories.