Documentation ¶
Index ¶
- Constants
- Variables
- func Define(c Config) error
- func EncodeToken(t Token, guestId string) (string, error)
- func List() []string
- func Save(name string, config Config) error
- type AcceptFunc
- type Access
- type AccessFile
- type AccessKey
- type CacheWriter
- type Config
- type Consumer
- type Feed
- type Header
- type Identity
- type Keystore
- type Pool
- func (p *Pool) BaseId() uint64
- func (p *Pool) Close()
- func (p *Pool) CreateBranch(sub string, ids []string, apps []string) (Config, error)
- func (p *Pool) Delete() error
- func (p *Pool) HouseKeeping()
- func (p *Pool) Identities() ([]security.Identity, error)
- func (p *Pool) List(offset int) ([]Feed, error)
- func (p *Pool) Receive(id uint64, rang *transport.Range, w io.Writer) error
- func (p *Pool) Send(name string, r io.Reader, meta []byte) (Feed, error)
- func (p *Pool) SetAccess(userId string, state State) error
- func (p *Pool) Sync() error
- func (p *Pool) ToString() string
- type State
- type Token
Constants ¶
View Source
const ( ID_CREATE = 0x0 ID_FORCE_CREATE = 0x1 )
View Source
const All = ""
View Source
const FeedsFolder = "feeds"
View Source
const IdentityFolder = "identities"
View Source
const SafeConfigFile = ".safepool-pool.json"
Variables ¶
View Source
var CachePath string
View Source
var CacheSizeMB = 16
View Source
var Connections = map[string]transport.Exchanger{}
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 ErrInvalidSignature = errors.New("signature is invalid")
View Source
var ErrInvalidToken = errors.New("provided token is invalid: missing name or configs")
View Source
var ErrNoExchange = errors.New("no Exchange available")
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 LifeSpan = time.Hour //30 * 24 * time.Hour
LifeSpan is the maximal time data should stay in the pool. It is default to 30 days.
View Source
var ReplicaPeriod = time.Hour
Functions ¶
Types ¶
type AcceptFunc ¶
type AcceptFunc func(feed Feed)
type AccessFile ¶
type CacheWriter ¶
type CacheWriter struct {
// contains filtered or unexported fields
}
func (*CacheWriter) Close ¶
func (c *CacheWriter) Close()
type Pool ¶
type Pool struct { Name string `json:"name"` Self security.Identity `json:"self"` Apps []string `json:"apps"` Trusted bool `json:"trusted"` // contains filtered or unexported fields }
func (*Pool) CreateBranch ¶
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
Click to show internal directories.
Click to hide internal directories.