Documentation ¶
Index ¶
- Constants
- func CleanTestEnv()
- func CreateFile(sFile string, size int) error
- func DeleteLocalFile(filename string)
- func GetFileHash(filename string) (string, error)
- func GetFilename(size int) string
- func GetHash(data []byte) string
- func GetRndBytes(size int) []byte
- func GetTmp() string
- func SetTestEnv()
- type MultiStorage
- func (m *MultiStorage) Add(name string, def StorageDefinition) error
- func (m *MultiStorage) AddLocal(name string, base string) error
- func (m *MultiStorage) Download(sName string, name string, filename string) (string, error)
- func (m *MultiStorage) Exist(name string) bool
- func (m *MultiStorage) Get(sName string, name string) ([]byte, error)
- func (m *MultiStorage) LoadByJSON(data []byte) error
- func (m *MultiStorage) Names() []string
- func (m *MultiStorage) Put(sName string, name string, data []byte) error
- func (m *MultiStorage) Size() int
- func (m *MultiStorage) Upload(sName string, filename string, name string) error
- type MultiStorageOption
- type SFTP
- type Storage
- type StorageDefinition
- type StorageDefinitions
- type StowStorage
- type StreamHash
- type TestLocalMultistorage
Constants ¶
const ( Test_email = "losangeles971@gmail.com" Test_password = "losangeles971@gmail.com" )
const (
KIRINUKI_TMP = "KIRINUKI_TMP"
)
const (
TEMP_STORAGE = "temp"
)
Variables ¶
This section is empty.
Functions ¶
func CleanTestEnv ¶
func CleanTestEnv()
func CreateFile ¶
func DeleteLocalFile ¶
func DeleteLocalFile(filename string)
func GetFileHash ¶
func GetFilename ¶
func GetRndBytes ¶
func GetTmp ¶
func GetTmp() string
GetTmp: it returns the local temporary directory The local temporary directory is always necessary, since it is used to split e rebuild Kirinuki files.
func SetTestEnv ¶
func SetTestEnv()
Types ¶
type MultiStorage ¶
type MultiStorage struct {
// contains filtered or unexported fields
}
MultiStorage: it allows to deal with all defined storage targets (upload, download, delete, ...)
func NewMultiStorage ¶
func NewMultiStorage(opts ...MultiStorageOption) (*MultiStorage, error)
NewStorageMap creates a new StorageMap (empty or populated depending on the options)
func (*MultiStorage) Add ¶
func (m *MultiStorage) Add(name string, def StorageDefinition) error
Add: it allows to manually add a storage target defined by ci
func (*MultiStorage) Exist ¶
func (m *MultiStorage) Exist(name string) bool
func (*MultiStorage) LoadByJSON ¶
func (m *MultiStorage) LoadByJSON(data []byte) error
func (*MultiStorage) Names ¶
func (m *MultiStorage) Names() []string
Names: it returns the list of storage targets' names
func (*MultiStorage) Size ¶
func (m *MultiStorage) Size() int
type MultiStorageOption ¶
type MultiStorageOption func(*MultiStorage) error
type SFTP ¶
type SFTP struct {
// contains filtered or unexported fields
}
type Storage ¶
type Storage interface { Name() string Get(name string) ([]byte, error) Put(name string, data []byte) error Download(name string, filename string) (string, error) // save a file from target storage locally and computing the hash Upload(filename string, name string) error }
Storage defines the interface of a generic storage target
func NewStowStorage ¶
func NewStowStorage(name string, def StorageDefinition) (Storage, error)
type StorageDefinition ¶
type StorageDefinition struct { Type string `yaml:"type" json:"type"` Cfg map[string]string `yaml:"config" json:"config"` // configuration parameters }
StorageDefinition defines a specific storage target
type StorageDefinitions ¶
type StorageDefinitions struct {
Map map[string]StorageDefinition `yaml:"map" json:"map"`
}
StorageDefinitions contains a list of defined storage targets
type StowStorage ¶
type StowStorage struct {
// contains filtered or unexported fields
}
func (StowStorage) Download ¶
func (s StowStorage) Download(name string, filename string) (string, error)
func (StowStorage) Get ¶
func (s StowStorage) Get(name string) ([]byte, error)
Get returns a file (if exist) from the storage target
func (StowStorage) Name ¶
func (s StowStorage) Name() string
type StreamHash ¶
type StreamHash struct {
// contains filtered or unexported fields
}
func NewStreamHash ¶
func NewStreamHash(r io.Reader) StreamHash
func (StreamHash) GetHash ¶
func (s StreamHash) GetHash() string
func (StreamHash) GetReader ¶
func (s StreamHash) GetReader() io.Reader
type TestLocalMultistorage ¶
type TestLocalMultistorage struct {
// contains filtered or unexported fields
}
func NewTestLocalMultistorage ¶
func NewTestLocalMultistorage(tDir string) *TestLocalMultistorage
NewLocalMultistorage: it creates a multistorage for testing purpose. This multistorage only uses local filesystem by means of a single Local Storage Target
func (*TestLocalMultistorage) Clean ¶
func (tsm *TestLocalMultistorage) Clean()
func (*TestLocalMultistorage) GetMultiStorage ¶
func (tsm *TestLocalMultistorage) GetMultiStorage() *MultiStorage