Documentation ¶
Index ¶
- Constants
- Variables
- func AppendSlashIf(path string) string
- func CabriPlumberDefaultConfig(serial bool, redLimit int) plumber.Config
- func CleanObsDss(config ObsConfig) error
- func CmpAcl(acl1, acl2 []ACLEntry) bool
- func Decrypt(src io.Reader, sids ...string) (io.Reader, error)
- func DecryptFileWithPass(source, target, pass string) error
- func DecryptMsg(jbs []byte, sids ...string) (string, error)
- func DecryptMsgWithPass(jbs []byte, pass string) (string, error)
- func DecryptUserConfig(config DssBaseConfig, configDir string) error
- func Encrypt(dst io.Writer, srs ...string) (io.WriteCloser, error)
- func EncryptFileWithPass(source, target, pass string) error
- func EncryptMsg(msg string, srs ...string) ([]byte, error)
- func EncryptMsgWithPass(msg string, pass string) ([]byte, error)
- func EncryptUserConfig(config DssBaseConfig, configDir string) error
- func GetCustomConfig(c echo.Context) interface{}
- func GetHomeConfigDir(config DssBaseConfig) (string, error)
- func GetServerIndexesForTests(dss HDss) (Index, Index)
- func HasRaiseError() bool
- func IdPkeys(uc UserConfig) (users []string)
- func IdSecrets(uc UserConfig) (secrets []string)
- func LoadDssConfig(bc DssBaseConfig, persistentConfig interface{}) error
- func MkallContent(dss Dss, cpath string, mtime int64) error
- func MkallNs(dss Dss, npath string, mtime int64) error
- func NewClientErr(where string, resp *http.Response, err error, bs []byte) error
- func NewReadCloserWithCb(underlying io.Reader, closeCb func() error) (io.ReadCloser, error)
- func NewServerErr(where string, err error) error
- func NewTempFileWriteCloserWithCb(fs afero.Fs, dir, pattern string, closeCb WriteCloserErrCb) (io.WriteCloser, error)
- func NewWriteCloserWithCb(underlying io.WriteCloser, closeCb WriteCloserErrCb) io.WriteCloser
- func OsUserHomeDir() (string, error)
- func OverwriteDssConfig(bc DssBaseConfig, dssConfig interface{}) error
- func Parent(npath string) (parent string)
- func RemoveSlashIf(path string) string
- func RemoveSlashIfNsIf(path string, isNs bool) string
- func RestServerConfigurator(e *echo.Echo, root string, configs map[string]interface{}) error
- func SaveDssConfig(bc DssBaseConfig, dssConfig interface{}) error
- func SaveUserConfig(config DssBaseConfig, configDir string, uc UserConfig) error
- func UserConfigPutIdentity(config DssBaseConfig, configDir string, identity IdentityConfig) error
- func Users(aes []ACLEntry) (users []string)
- func WebDssServerConfigurator(e *echo.Echo, root string, configs map[string]interface{}) error
- func WebTestServerConfigurator(e *echo.Echo, root string, _ map[string]interface{}) error
- func WfsDssServerConfigurator(e *echo.Echo, root string, configs map[string]interface{}) error
- type ACLEntry
- type AuditIndexInfo
- type Client
- type ClientReqOpts
- type ContentHandle
- type CreateNewParams
- type Dss
- type DssBaseConfig
- type EDssConfig
- type ErrBadParameter
- type ErrorCollector
- type FsyConfig
- type FsyDss
- func (fsy *FsyDss) Close() error
- func (fsy *FsyDss) GetAfs() afero.Fs
- func (fsy *FsyDss) GetContentReader(npath string) (rc io.ReadCloser, err error)
- func (fsy *FsyDss) GetContentWriter(npath string, mtime int64, acl []ACLEntry, cb WriteCloserCb) (wc io.WriteCloser, err error)
- func (fsy *FsyDss) GetMeta(npath string, getCh bool) (meta IMeta, err error)
- func (fsy *FsyDss) GetRoot() string
- func (fsy *FsyDss) IsDuplicate(ch string) (bool, error)
- func (fsy *FsyDss) Lsns(npath string) (children []string, err error)
- func (fsy *FsyDss) Mkns(npath string, mtime int64, children []string, acl []ACLEntry) error
- func (fsy *FsyDss) Remove(npath string) (err error)
- func (fsy *FsyDss) SetAfs(afs afero.Fs)
- func (fsy *FsyDss) SetCurrentTime(time int64)
- func (fsy *FsyDss) SetMetaMockCbs(cbs *MetaMockCbs)
- func (fsy *FsyDss) SetSu()
- func (fsy *FsyDss) SuEnableWrite(npath string) error
- func (fsy *FsyDss) Symlink(npath string, tpath string, mtime int64, acl []ACLEntry) error
- func (fsy *FsyDss) Updatens(npath string, mtime int64, children []string, acl []ACLEntry) error
- type HDss
- func CreateObsDss(config ObsConfig) (HDss, error)
- func CreateOlfDss(config OlfConfig) (HDss, error)
- func NewEDss(config EDssConfig, slsttime int64, aclusers []string) (HDss, error)
- func NewObsDss(config ObsConfig, slsttime int64, aclusers []string) (HDss, error)
- func NewOlfDss(config OlfConfig, slsttime int64, aclusers []string) (HDss, error)
- func NewWebDss(config WebDssConfig, slsttime int64, aclusers []string) (HDss, error)
- type HistoryChunk
- type HistoryInfo
- type IMeta
- type IS3Session
- type IdentityConfig
- type Index
- type LibApiDssConfig
- type Meta
- func (m Meta) Equals(om IMeta, chacl bool) bool
- func (m Meta) GetAcl() []ACLEntry
- func (m Meta) GetCh() string
- func (m Meta) GetChUnsafe() string
- func (m Meta) GetChildren() []string
- func (m Meta) GetIsNs() bool
- func (m Meta) GetIsSymLink() bool
- func (m Meta) GetItime() int64
- func (m Meta) GetMtime() int64
- func (m Meta) GetPath() string
- func (m Meta) GetSize() int64
- func (m Meta) GetSymLinkTarget() string
- type MetaMockCbs
- type ODss
- func (ods *ODss) AuditIndex() (map[string][]AuditIndexInfo, error)
- func (ods *ODss) Close() error
- func (ods *ODss) DumpIndex() string
- func (ods *ODss) GetAfs() afero.Fs
- func (ods *ODss) GetContentReader(npath string) (rc io.ReadCloser, err error)
- func (ods *ODss) GetContentWriter(npath string, mtime int64, acl []ACLEntry, cb WriteCloserCb) (wc io.WriteCloser, err error)
- func (ods *ODss) GetHistory(npath string, recursive bool, resolution string) (map[string][]HistoryInfo, error)
- func (ods *ODss) GetHistoryChunks(resolution string) ([]HistoryChunk, error)
- func (ods *ODss) GetIndex() Index
- func (ods *ODss) GetMeta(npath string, getCh bool) (meta IMeta, err error)
- func (ods *ODss) GetRepoId() string
- func (ods *ODss) IsDuplicate(ch string) (bool, error)
- func (ods *ODss) IsEncrypted() bool
- func (ods *ODss) IsRepoEncrypted() bool
- func (ods *ODss) Lsns(npath string) (children []string, err error)
- func (ods *ODss) Mkns(npath string, mtime int64, children []string, acl []ACLEntry) error
- func (ods *ODss) Reindex() (StorageInfo, *ErrorCollector)
- func (ods *ODss) Remove(npath string) (err error)
- func (ods *ODss) RemoveHistory(npath string, recursive, evaluate bool, start, end int64) (map[string][]HistoryInfo, error)
- func (ods *ODss) ScanStorage(checksum, purge, purgeHidden bool) (StorageInfo, *ErrorCollector)
- func (ods *ODss) SetAfs(tfs afero.Fs)
- func (ods *ODss) SetCurrentTime(time int64)
- func (ods *ODss) SetMetaMockCbs(cbs *MetaMockCbs)
- func (ods *ODss) SetSu()
- func (ods *ODss) SuEnableWrite(string) error
- func (ods *ODss) Symlink(npath string, tpath string, mtime int64, acl []ACLEntry) (err error)
- func (ods *ODss) Updatens(npath string, mtime int64, children []string, acl []ACLEntry) error
- type ObsConfig
- type OlfConfig
- type PixClient
- type PixClients
- type ReadCloserWithCb
- type Rights
- type S3Meta
- type SIHnIt
- type StorageInfo
- type TempFileWriteCloserWithCb
- type TimeResolution
- type TimedMeta
- type TlsConfig
- type UnixNanoUTC
- type UnixUTC
- type UpdatedData
- type UserConfig
- type WebApiClient
- type WebDssConfig
- type WebDssServerConfig
- type WebServer
- func NewEServer(addr string, hasLog bool, tlsConfig *TlsConfig) WebServer
- func NewRestServer(root string, config WebDssServerConfig) (WebServer, error)
- func NewWebDssServer(root string, config WebDssServerConfig) (WebServer, error)
- func NewWfsDssServer(root string, config WfsDssServerConfig) (WebServer, error)
- type WebServerConfig
- type WfsDssConfig
- type WfsDssServerConfig
- type WriteCloserCb
- type WriteCloserErrCb
- type WriteCloserWithCb
Constants ¶
const MAX_META_SIZE = 100000
const MAX_TIME int64 = 9223372036854775807
const MIN_TIME int64 = -9223372036854775808
Variables ¶
var ( // ErrPasswordRequired is returned when accessing encrypted content // without access to the user's master password ErrPasswordRequired = errors.New("password required to perform this action") )
Functions ¶
func AppendSlashIf ¶
func CleanObsDss ¶
CleanObsDss cleans an "object-storage" DSS (data storage system) config provides the object store specification
func Decrypt ¶
Decrypt decrypts a file encrypted to one or more sids X25519 identities encoded as strings.
It returns a Reader reading the decrypted plaintext of the age file read from src. All identities will be tried until one successfully decrypts the file.
func DecryptFileWithPass ¶
DecryptFileWithPass decrypts a file source to a file target with a given password pass using Scrypt encoding
func DecryptMsg ¶
DecryptMsg decrypts jbs encrypted content to one or more sids X25519 identities encoded as strings. It returns the message in cleartext
jbs are the json encoded bytes
All identities will be tried until one successfully decrypts the content.
func DecryptMsgWithPass ¶
DecryptMsgWithPass decrypts jbs encrypted content with a given password using Scrypt encoding It returns the message in cleartext
jbs are the json encoded bytes
func DecryptUserConfig ¶
func DecryptUserConfig(config DssBaseConfig, configDir string) error
func Encrypt ¶
Encrypt encrypts a file to one or more X25519 srs recipients encoded as strings.
Writes to the returned WriteCloser are encrypted and written to dst as an age file. Every recipient will be able to decrypt the file.
The caller must call Close on the WriteCloser when done for the last chunk to be encrypted and flushed to dst.
func EncryptFileWithPass ¶
EncryptFileWithPass encrypts a file source to a file target with a given password pass using Scrypt encoding
func EncryptMsg ¶
EncryptMsg encrypts a msg to one or more X25519 srs recipients encoded as strings.
Every recipient will be able to decrypt the result.
It returns the encrypted content as json encoded bytes.
func EncryptMsgWithPass ¶
EncryptMsgWithPass encrypts a msg with a given password using Scrypt encoding
It returns the encrypted content as json encoded bytes.
func EncryptUserConfig ¶
func EncryptUserConfig(config DssBaseConfig, configDir string) error
func GetCustomConfig ¶
func GetCustomConfig(c echo.Context) interface{}
func GetHomeConfigDir ¶
func GetHomeConfigDir(config DssBaseConfig) (string, error)
func HasRaiseError ¶
func HasRaiseError() bool
func IdPkeys ¶
func IdPkeys(uc UserConfig) (users []string)
func IdSecrets ¶
func IdSecrets(uc UserConfig) (secrets []string)
func LoadDssConfig ¶
func LoadDssConfig(bc DssBaseConfig, persistentConfig interface{}) error
func NewClientErr ¶
func NewReadCloserWithCb ¶
func NewServerErr ¶
func NewTempFileWriteCloserWithCb ¶
func NewTempFileWriteCloserWithCb(fs afero.Fs, dir, pattern string, closeCb WriteCloserErrCb) (io.WriteCloser, error)
func NewWriteCloserWithCb ¶
func NewWriteCloserWithCb(underlying io.WriteCloser, closeCb WriteCloserErrCb) io.WriteCloser
func OsUserHomeDir ¶
func OverwriteDssConfig ¶
func OverwriteDssConfig(bc DssBaseConfig, dssConfig interface{}) error
func RemoveSlashIf ¶
func RemoveSlashIfNsIf ¶
func RestServerConfigurator ¶
func SaveDssConfig ¶
func SaveDssConfig(bc DssBaseConfig, dssConfig interface{}) error
func SaveUserConfig ¶
func SaveUserConfig(config DssBaseConfig, configDir string, uc UserConfig) error
func UserConfigPutIdentity ¶
func UserConfigPutIdentity(config DssBaseConfig, configDir string, identity IdentityConfig) error
Types ¶
type ACLEntry ¶
type ACLEntry struct { // on unix-like fsy DSS: x-uid:<uid> or x-gid:<gid> will be honored User string `json:"user"` // on encrypted DSS, any alias for an IdentityConfig whose secret is owned by the user will be honored Rights Rights `json:"rights"` }
func CheckUiACL ¶
CheckUiACL convert a list of <user:rights> strings into actual ACL
type AuditIndexInfo ¶
type AuditIndexInfo struct { Error string // "IndexInternal", "IndexMissing", "StorageMissing", "Inconsistent" Err error // origin error Time int64 // the time of the entry in the DSS Bytes []byte // the metadata }
func (AuditIndexInfo) String ¶
func (aii AuditIndexInfo) String() string
type ClientReqOpts ¶
type ClientReqOpts struct {
// contains filtered or unexported fields
}
type ContentHandle ¶
type ContentHandle struct {
// contains filtered or unexported fields
}
func (*ContentHandle) Close ¶
func (ch *ContentHandle) Close() (err error)
type CreateNewParams ¶
type CreateNewParams struct { ConfigPassword string // if not "" master password used to encrypt client configuration ConfigDir string // if not "" path to the user's configuration directory Create bool // perform CreateXxx or NewXxx? DssType string // fsy, olf, obs, smf Root string // fsy, olf, smf Size string // if olf: s,m,l LocalPath string // fsy, obs, smf (Root assumed if olf or smf) Encrypted bool // all but fsy: enable repository encryption GetIndex func(config DssBaseConfig, localPath string) (Index, error) // see DssBaseConfig Lsttime int64 // all but fsy: if not zero is the upper time of entries retrieved in it Aclusers []string // all but fsy: if not nil is a List of ACL users for access check Endpoint string // obs: AWS S3 or Openstack Swift endpoint, eg "https://s3.gra.cloud.ovh.net" Region string // obs: AWS S3 or Openstack Swift region, eg "GRA" AccessKey string // obs: AWS S3 access key (Openstack Swift must generate it) SecretKey string // obs: AWS S3 secret key (Openstack Swift must generate it) Container string // obs: AWS S3 bucket or Openstack Swift container RedLimit int // all: reducer limit or 0 }
type Dss ¶
type Dss interface { // Mkns creates a namespace in the Dss, return an error if any happens // // npath is the full namespace without leading or trailing slash // mtime is the last modification POSIX time // children are the children names, a trailing slash denotes a namespace, else regular content // acl is the access control List to the namespace Mkns(npath string, mtime int64, children []string, acl []ACLEntry) error // Updatens updates a namespace in the Dss, return an error if any happens // // npath is the full namespace without leading or trailing slash // mtime is the last modification POSIX time // children are the children names, a trailing slash denotes a namespace, else regular content // acl is the access control List to the namespace Updatens(npath string, mtime int64, children []string, acl []ACLEntry) error // Lsns lists a namespace's content, return it or an error if any happens // // npath is the full namespace without leading or trailing slash // // returns: // - children names, a trailing slash denotes a namespace, else regular content // - err error if any happens Lsns(npath string) (children []string, err error) // IsDuplicate checks if content's checksum ch already exists in DSS // // returns duplicate status and an error if any happens IsDuplicate(ch string) (bool, error) // GetContentWriter creates content for writing // // npath is the full namespace + name without leading slash // mtime is the last modification POSIX time // acl is the access control List to the content // cb if not nil is a callback called when writer is closed // // returns: // - a writer to provide the content // - err error if any happens GetContentWriter(npath string, mtime int64, acl []ACLEntry, cb WriteCloserCb) (io.WriteCloser, error) // GetContentReader opens content for reading // // npath is the full namespace + name without leading slash // // returns: // - a reader to retrieve the content // - err error if any happens GetContentReader(npath string) (io.ReadCloser, error) // Symlink makes a symlink from npath to target path // // npath is the full namespace + name without leading slash // tpath is the target as a relative path following underlying OS conventions // mtime is the last modification POSIX time // acl is the access control List to the content // // returns: // - err error if any happens Symlink(npath string, tpath string, mtime int64, acl []ACLEntry) error // Remove removes a namespace (and recursively its children) or some content // // npath is the full namespace + name without leading slash, trailing slash indicates it is a namespace // // returns: // - err error if any happens Remove(npath string) error // GetMeta gets a namespace or some content metadata // // npath is the full namespace + name without leading slash, trailing slash indicates it is a namespace // // returns: // - the metadata // - err error if any happens GetMeta(npath string, getCh bool) (IMeta, error) // SetCurrentTime injects arbitrary current time for tests // does nothing on fsy DSS SetCurrentTime(time int64) // SetMetaMockCbs injects arbitrary json [un]marshal for tests if build tag constraint enables SetMetaMockCbs(cbs *MetaMockCbs) // SetAfs injects abstract FS for tests if build tag constraint enables SetAfs(tfs afero.Fs) // GetAfs retrieves it GetAfs() afero.Fs // Close can be necessary to perform final cleanup or index synchronization Close() error // SetSu enables superuser access for synchro SetSu() // SuEnableWrite enables physical write access for fsy: DSS in case SetSu is active // // npath is the full namespace + name without leading slash, trailing slash indicates it is a namespace // // returns: // - err error if any happens SuEnableWrite(npath string) error }
Dss is the Data Storage System interface.
Any Dss should implement this interface.
func CreateOrNewDss ¶
func CreateOrNewDss(params CreateNewParams) (dss Dss, err error)
func NewWfsDss ¶
func NewWfsDss(wdc WfsDssConfig) (Dss, error)
NewWfsDss opens a web client for a remote "fsy" DSS (data storage system) wdc provides the web client configuration returns a pointer to the ready to use DSS or an error if any occur
type DssBaseConfig ¶
type DssBaseConfig struct { ConfigDir string `json:"-"` // if not "" path to the user's configuration directory ConfigPassword string `json:"-"` // if master password is used to encrypt client configuration LocalPath string `json:"-"` // local path for configuration and index, or "" if unused (index will be memory based) RepoId string `json:"repoId"` // uuid of the repository Unlock bool `json:"-"` // unlocks index concurrent updates lock AutoRepair bool `json:"autoRepair"` // if unlock required, automatically repairs the index ReIndex bool `json:"-"` // forces full content reindexation GetIndex func(config DssBaseConfig, localPath string) (Index, error) `json:"-"` // non-default function to instantiate an index XImpl string `json:"xImpl"` // index implementation code: bdb, memory, no LibApi bool `json:"-"` // prevents using a web API server for local DSS access WebProtocol string `json:"-"` // web API server protocol WebHost string `json:"-"` // web API server host WebPort string `json:"-"` // web API server port WebClientTimeout time.Duration `json:"-"` // client timeout in seconds, a Timeout of zero means no timeout TlsCert string `json:"-"` // certificate file on https server or untrusted CA on https client TlsKey string `json:"-"` // certificate key file on https server TlsNoCheck bool `json:"-"` // no check of certificate by https client BasicAuthUser string `json:"-"` // adds basic authentication BasicAuthPassword string `json:"-"` // basic authentication password WebRoot string `json:"-"` // web API server root Encrypted bool `json:"encrypted"` // repository is encrypted ReducerLimit int `json:"-"` // if not 0 max number of parallel I/O }
type EDssConfig ¶
type EDssConfig struct {
WebDssConfig
}
type ErrBadParameter ¶
ErrBadParameter is returned when REST API receives a bad parameter
func (*ErrBadParameter) Error ¶
func (e *ErrBadParameter) Error() string
func (*ErrBadParameter) Unwrap ¶
func (e *ErrBadParameter) Unwrap() error
type ErrorCollector ¶
type ErrorCollector []error
func (*ErrorCollector) Any ¶
func (c *ErrorCollector) Any() bool
func (*ErrorCollector) Collect ¶
func (c *ErrorCollector) Collect(e error)
func (*ErrorCollector) Error ¶
func (c *ErrorCollector) Error() (err string)
type FsyConfig ¶
type FsyConfig struct {
DssBaseConfig
}
type FsyDss ¶
type FsyDss struct {
// contains filtered or unexported fields
}
func (*FsyDss) GetContentReader ¶
func (fsy *FsyDss) GetContentReader(npath string) (rc io.ReadCloser, err error)
func (*FsyDss) GetContentWriter ¶
func (fsy *FsyDss) GetContentWriter(npath string, mtime int64, acl []ACLEntry, cb WriteCloserCb) (wc io.WriteCloser, err error)
func (*FsyDss) SetCurrentTime ¶
func (*FsyDss) SetMetaMockCbs ¶
func (fsy *FsyDss) SetMetaMockCbs(cbs *MetaMockCbs)
func (*FsyDss) SuEnableWrite ¶
type HDss ¶
type HDss interface { Dss // GetHistory gets the history of the npath entry as a map of entry state sorted by time // // npath is the full namespace + name without leading slash, trailing slash indicates it is a namespace // recursive requests the service to recursively get the history of all namespace children // resolution "s" for seconds, "m" for minutes, "h" for hours, "d" for days summarizes the history with given resolution // // returns: // - the history (inclusive times when the entry is visible) for all entries // - err error if any happens GetHistory(npath string, recursive bool, resolution string) (map[string][]HistoryInfo, error) // RemoveHistory removes history entries for a given time period // // it must be noted that removing a parent history may cause children to be removed for a larger period of time // // npath is the full namespace + name without leading slash, trailing slash indicates it is a namespace // recursive requests the service to recursively remove the history of all namespace children, // evaluate don't remove, just report work to be done // start is the inclusive index time above which entries must be removed, zero meanning all past entries // end is the inclusive index time below which entries must be removed, zero meaning all future entries // // returns: // - the history (inclusive times when the entry is removed) for all entries // - err error if any happens RemoveHistory(npath string, recursive, evaluate bool, start, end int64) (map[string][]HistoryInfo, error) // GetIndex provides the DSS index or nil GetIndex() Index // DumpIndex for debug DumpIndex() string // GetRepoId provides the DSS repoId or "" GetRepoId() string // IsEncrypted tells if repository is encrypted IsEncrypted() bool // IsRepoEncrypted tells if repository configuration is set to encrypted IsRepoEncrypted() bool // AuditIndex compares the DSS index with meta and content actually stored AuditIndex() (map[string][]AuditIndexInfo, error) // ScanStorage scans the DSS storage and loads meta and content sha256 sum // // checksum checks content checksums // purge removes unreferenced content from the repository // purgeHidden removes hidden meta and content from the repository ScanStorage(checksum, purge, purgeHidden bool) (StorageInfo, *ErrorCollector) // GetHistoryChunks returns history chunks loaded from local index // // resolution s, m, h, d from seconds to days // // returns: // - the DSS activity periods sorted by time // - err error if any happens GetHistoryChunks(resolution string) ([]HistoryChunk, error) // Reindex scans the DSS storage and loads meta and content sha256 sum into the index Reindex() (StorageInfo, *ErrorCollector) }
HDss is the Data Storage System interface for DSS with history support.
func CreateObsDss ¶
CreateObsDss creates an "object-storage" DSS (data storage system) config provides the object store specification returns a pointer to the ready to use DSS or an error if any occur
func CreateOlfDss ¶
CreateOlfDss creates an "object-storage-like files" DSS data storage system config provides the object store specification returns a pointer to the ready to use DSS or an error if any occur
func NewEDss ¶
func NewEDss(config EDssConfig, slsttime int64, aclusers []string) (HDss, error)
NewEDss opens a web or direct api client for an "object-storage" encrypted DSS (data storage system) config provides the object store specification lsttime if not zero is the upper time of entries retrieved in it aclusers if not nil is a List of ACL users for access check and for decryption returns a pointer to the ready to use DSS or an error if any occur If lsttime is not zero, access will be read-only
func NewObsDss ¶
NewObsDss opens an "object-storage" DSS (data storage system) config provides the object store specification lsttime if not zero is the upper time of entries retrieved in it aclusers if not nil is a List of ACL users for access check returns a pointer to the ready to use DSS or an error if any occur If lsttime is not zero, access will be read-only
func NewOlfDss ¶
NewOlfDss opens an "object-storage-like files" DSS (data storage system) config provides the object store specification lsttime if not zero is the upper time of entries retrieved in it aclusers if not nil is a List of ACL users for access check returns a pointer to the ready to use DSS or an error if any occur If lsttime is not zero, access will be read-only
func NewWebDss ¶
func NewWebDss(config WebDssConfig, slsttime int64, aclusers []string) (HDss, error)
NewWebDss opens a web client for an "object-storage" DSS (data storage system) config provides the object store specification lsttime if not zero is the upper time of entries retrieved in it aclusers if not nil is a List of ACL users for access check returns a pointer to the ready to use DSS or an error if any occur If lsttime is not zero, access will be read-only
type HistoryChunk ¶
type HistoryChunk struct { Start int64 `json:"start"` // period start time POSIX aligned to resolution End int64 `json:"end"` // period end time POSIX aligned to resolution Count int `json:"count"` // number of history updates in the time period }
func (HistoryChunk) String ¶
func (hc HistoryChunk) String() string
type HistoryInfo ¶
type HistoryInfo struct { Start int64 // start time POSIX of the history entry End int64 // end time POSIX of the history entry HMeta Meta // the metadata }
func (HistoryInfo) String ¶
func (hi HistoryInfo) String() string
type IMeta ¶
type IMeta interface { GetPath() string // path in the DSS GetMtime() int64 // last modification POSIX time GetSize() int64 // content size GetCh() string // content truncated SHA256 checksum (panic if DSS does not enable) GetChUnsafe() string // content truncated SHA256 checksum or empty if DSS does not enable GetIsNs() bool // is it a namespace, if true has children GetChildren() []string // namespace children, sorted by name GetIsSymLink() bool // is it a symbolic link, if true has SymLinkTarget GetSymLinkTarget() string // target of the symbolic link GetAcl() []ACLEntry // access control List, sorted by user GetItime() int64 // index time Equals(other IMeta, chacl bool) bool // checks equality (does not compare Ch if one end is unavailable) compare ACL if chacl true }
type IS3Session ¶
type IS3Session interface { Initialize() error Check() error List(prefix string) ([]string, error) Meta(key string) (S3Meta, error) Put(key string, content []byte) error Get(key string) ([]byte, error) Upload(key string, r io.Reader) error Download(key string) (io.ReadCloser, error) Delete(key string) error DeleteAll(prefix string) error }
func NewS3Session ¶
func NewS3Session(config ObsConfig, getMock func(IS3Session) IS3Session) IS3Session
func NewS3sMockFs ¶
func NewS3sMockFs(root string, getMock func(IS3Session) IS3Session) IS3Session
func NewS3sMockTests ¶
func NewS3sMockTests(parent IS3Session, testsCb func(args ...any) interface{}) IS3Session
type IdentityConfig ¶
type IdentityConfig struct { Alias string `json:"alias"` PKey string `json:"pKey"` Secret string `json:"secret"` }
IdentityConfig refers to an age identity identified by an alias, Identities are used for encryption (PKeys of the ACL users using identities aliases) and for decryption (secrets of the DSS aclusers using identities aliases) "" is the default alias for an identity when none is provided
func GenIdentity ¶
func GenIdentity(alias string) (IdentityConfig, error)
type Index ¶
type Index interface { IsPersistent() bool Close() error Repair(readOnly bool) ([]string, error) Dump() string // contains filtered or unexported methods }
type LibApiDssConfig ¶
type Meta ¶
type Meta struct { Path string `json:"path"` // full path for data content Mtime int64 `json:"mtime"` // last modification POSIX time Size int64 `json:"size"` // content size Ch string `json:"ch"` // truncated SHA256 checksum of the content IsNs bool `json:"isNs"` // is it a namespace, if true has children Children []string `json:"children"` // namespace children, sorted by name IsSymLink bool `json:"isSymLink,omitempty"` // is it a symbolic link, if true has SymLinkTarget SymLinkTarget string `json:"symLinkTarget,omitempty"` // target of the symbolic link ACL []ACLEntry `json:"acl"` // access control List, sorted by user Itime int64 `json:"itime"` // index time ECh string `json:"ech"` // truncated SHA256 checksum of the encrypted content if encrypted else empty EMId string `json:"emid"` // encrypted meta-data unique identifier if encrypted else empty }
func (Meta) GetChUnsafe ¶
func (Meta) GetChildren ¶
func (Meta) GetIsSymLink ¶
func (Meta) GetSymLinkTarget ¶
type MetaMockCbs ¶
type ODss ¶
type ODss struct {
// contains filtered or unexported fields
}
func (*ODss) AuditIndex ¶
func (ods *ODss) AuditIndex() (map[string][]AuditIndexInfo, error)
func (*ODss) GetContentReader ¶
func (ods *ODss) GetContentReader(npath string) (rc io.ReadCloser, err error)
func (*ODss) GetContentWriter ¶
func (ods *ODss) GetContentWriter(npath string, mtime int64, acl []ACLEntry, cb WriteCloserCb) (wc io.WriteCloser, err error)
func (*ODss) GetHistory ¶
func (*ODss) GetHistoryChunks ¶
func (ods *ODss) GetHistoryChunks(resolution string) ([]HistoryChunk, error)
func (*ODss) IsEncrypted ¶
func (*ODss) IsRepoEncrypted ¶
func (*ODss) Reindex ¶
func (ods *ODss) Reindex() (StorageInfo, *ErrorCollector)
func (*ODss) RemoveHistory ¶
func (*ODss) ScanStorage ¶
func (ods *ODss) ScanStorage(checksum, purge, purgeHidden bool) (StorageInfo, *ErrorCollector)
func (*ODss) SetCurrentTime ¶
func (*ODss) SetMetaMockCbs ¶
func (ods *ODss) SetMetaMockCbs(cbs *MetaMockCbs)
func (*ODss) SuEnableWrite ¶
type ObsConfig ¶
type ObsConfig struct { DssBaseConfig Endpoint string `json:"endpoint"` // AWS S3 or Openstack Swift endpoint, eg "https://s3.gra.cloud.ovh.net" Region string `json:"region"` // AWS S3 or Openstack Swift region, eg "GRA" AccessKey string `json:"accessKey"` // AWS S3 access key (Openstack Swift must generate it) SecretKey string `json:"secretKey"` // AWS S3 secret key (Openstack Swift must generate it) Container string `json:"container"` // AWS S3 bucket or Openstack Swift container GetS3Session func() IS3Session `json:"-"` // if not nil enables to set a mock S3 implementation }
type OlfConfig ¶
type OlfConfig struct { DssBaseConfig Root string // filesystem root for the OLF DSS Size string // DSS size may be small, medium or large ("s", "m" or "l") }
type PixClients ¶
type ReadCloserWithCb ¶
type ReadCloserWithCb struct {
// contains filtered or unexported fields
}
func (*ReadCloserWithCb) Close ¶
func (rcwc *ReadCloserWithCb) Close() error
type Rights ¶
type StorageInfo ¶
type StorageInfo struct { Path2Meta map[string][]byte `json:"path2Meta"` Path2CMeta map[string][]byte `json:"path2CMeta"` Path2HnIt map[string]SIHnIt `json:"path2HnIt"` ExistingCs map[string]bool `json:"existingCs"` ExistingEcs map[string]bool `json:"existingEcs"` Path2Content map[string]string `json:"path2Content"` Path2CContent map[string]string `json:"path2CContent"` Path2Error map[string]error `json:"path2Error"` XLMetas map[string]map[int64][]byte `json:"xlmetas"` // Local meta data XRMetas map[string]map[int64][]byte `json:"xrmetas"` // Remote meta data }
type TempFileWriteCloserWithCb ¶
type TempFileWriteCloserWithCb struct { WriteCloserWithCb // contains filtered or unexported fields }
type TimeResolution ¶
type TimeResolution string
TimeResolution values are "s" seconds, "m" minutes, "h" hours, "d" days
func (TimeResolution) Align ¶
func (tr TimeResolution) Align(ns int64) int64
func (TimeResolution) NanoSeconds ¶
func (tr TimeResolution) NanoSeconds() int64
type UnixNanoUTC ¶
type UnixNanoUTC int64
func (UnixNanoUTC) String ¶
func (t UnixNanoUTC) String() string
type UpdatedData ¶
type UserConfig ¶
type UserConfig struct { ClientId string `json:"clientId"` Identities []IdentityConfig Internal IdentityConfig }
func CurrentUserConfig ¶
func CurrentUserConfig(config DssBaseConfig) (uc UserConfig, err error)
func GetHomeUserConfig ¶
func GetHomeUserConfig(config DssBaseConfig) (UserConfig, error)
func GetUserConfig ¶
func GetUserConfig(config DssBaseConfig, configDir string) (UserConfig, error)
func (*UserConfig) GetIdentity ¶
func (uc *UserConfig) GetIdentity(alias string) IdentityConfig
func (*UserConfig) PutIdentity ¶
func (uc *UserConfig) PutIdentity(identity IdentityConfig)
type WebApiClient ¶
type WebDssConfig ¶
type WebDssConfig struct { DssBaseConfig LibApiDssConfig ClId string }
type WebDssServerConfig ¶
type WebDssServerConfig struct { WebServerConfig UserConfig Dss HDss }
type WebServer ¶
type WebServer interface { Serve() error Shutdown() error ConfigureApi( root string, customConfig interface{}, shutdownCallback func(root string, customConfigs map[string]interface{}) error, ctor func(e *echo.Echo, root string, customConfigs map[string]interface{}) error, ) error // contains filtered or unexported methods }
func NewRestServer ¶
func NewRestServer(root string, config WebDssServerConfig) (WebServer, error)
func NewWebDssServer ¶
func NewWebDssServer(root string, config WebDssServerConfig) (WebServer, error)
func NewWfsDssServer ¶
func NewWfsDssServer(root string, config WfsDssServerConfig) (WebServer, error)
type WebServerConfig ¶
type WebServerConfig struct { Addr string // host[:port] HasLog bool IsTls bool // https TlsCert string // certificate file on https server or untrusted CA on https client TlsKey string // certificate key file on https server TlsNoCheck bool // no check of certificate by https client BasicAuthUser string BasicAuthPassword string }
type WfsDssConfig ¶
type WfsDssConfig struct {
DssBaseConfig
}
type WfsDssServerConfig ¶
type WfsDssServerConfig struct { WebServerConfig Dss Dss }
type WriteCloserCb ¶
type WriteCloserErrCb ¶
type WriteCloserErrCb func(err error, size int64, ch string, me *WriteCloserWithCb) error
type WriteCloserWithCb ¶
type WriteCloserWithCb struct { Underlying io.WriteCloser // contains filtered or unexported fields }
func (*WriteCloserWithCb) Close ¶
func (wcwc *WriteCloserWithCb) Close() error