Documentation ¶
Index ¶
- Constants
- Variables
- func Define(c Config) error
- func List() []string
- func Save(name string, config Config) error
- type AcceptFunc
- type Access
- type AccessFile
- type AccessKey
- type Bandwidth
- type CacheWriter
- type Config
- type Consumer
- type Head
- type Header
- type Keystore
- type Pool
- func (p *Pool) BaseId() uint64
- func (p *Pool) Close()
- func (p *Pool) Delete()
- func (p *Pool) Dump() map[string]any
- func (p *Pool) ExportSelf(force bool) error
- func (p *Pool) HouseKeeping()
- func (p *Pool) Leave() error
- func (p *Pool) List(ctime int64) ([]Head, error)
- func (p *Pool) Receive(id uint64, rang *storage.Range, w io.Writer) error
- func (p *Pool) Send(name string, r io.ReadSeekCloser, size int64, meta []byte) (Head, error)
- func (p *Pool) SetAccess(userId string, state State) error
- func (p *Pool) Sub(sub string, ids []string, apps []string) (Config, error)
- func (p *Pool) Sync() ([]Head, error)
- func (p *Pool) SyncAccess(ignoreGuard bool) error
- func (p *Pool) ToString() string
- func (p *Pool) Users() ([]security.Identity, error)
- type State
Constants ¶
View Source
const ( ID_CREATE = 0x0 ID_FORCE_CREATE = 0x1 )
View Source
const All = ""
View Source
const FeedsFolder = "feeds"
View Source
const SyncAccessFrequency = 5 * time.Minute
Variables ¶
View Source
var CachePath string
View Source
var CacheSizeMB = 16
View Source
var Connections = map[string]storage.Storage{}
View Source
var ConnectionsMutex = &sync.Mutex{}
View Source
var ErrAlreadyExist = errors.New("pool already exists")
View Source
var ErrInvalidConfig = errors.New("provided config is invalid: missing name or configs")
View Source
var ErrInvalidId = errors.New("provided id not a valid ed25519 public key")
View Source
var ErrInvalidName = errors.New("provided pool has invalid name")
View Source
var ErrInvalidToken = errors.New("provided token is invalid: missing name or configs")
View Source
var ErrNoStorage = errors.New("no Storage available")
View Source
var ErrNoSyncClock = errors.New("cannot sync with global time server")
View Source
var ErrNotAuthorized = errors.New("no authorization for this file")
View Source
var ErrNotTrusted = errors.New("the author is not a trusted user")
View Source
var FeedDateFormat = "20060102"
View Source
var ForceCreation = false
View Source
var HouseKeepingPeriods = map[Bandwidth]time.Duration{ LowBandwidth: time.Hour, MediumBandwidth: 20 * time.Minute, HighBandwith: 5 * time.Minute, }
View Source
var LifeSpan = 30 * 24 * time.Hour
LifeSpan is the maximal time data should stay in the pool. It is default to 30 days.
Functions ¶
Types ¶
type AcceptFunc ¶
type AcceptFunc func(feed Head)
type AccessFile ¶
type CacheWriter ¶
type CacheWriter struct {
// contains filtered or unexported fields
}
func (*CacheWriter) Close ¶
func (c *CacheWriter) Close()
type Config ¶
type Pool ¶
type Pool struct { Name string `json:"name"` Id uint64 `json:"id"` Self security.Identity `json:"self"` Apps []string `json:"apps"` LifeSpanHours int `json:"lifeSpanHours"` Trusted bool `json:"trusted"` Connection string `json:"connection"` // contains filtered or unexported fields }
func (*Pool) ExportSelf ¶
func (*Pool) HouseKeeping ¶
func (p *Pool) HouseKeeping()
HouseKeeping removes old files from the pool. It is called automatically when you use Sync after an hour; use explicitly only when your application does not use sync or does not live longer than 1 hour
func (*Pool) SyncAccess ¶
Click to show internal directories.
Click to hide internal directories.