Documentation
¶
Overview ¶
The ststore package provides a concurrent in-memory sharetoken store which is synced to disk after modifications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ContractKeyFunc = func(st *sharetoken.T) (k1, k2, k3 string) {
return st.PublicKey.String(), st.RelayPubkey.String(), st.Signature.String()
}
ContractKeyFunc is the standard key derivation function for service contracts. The store is organized as such: servicekey public key -> relay public key -> sharetoken signature + .json
var DuplicateSTError = errors.New("duplicate sharetoken")
DuplicateSTError is returned if a sharetoken which was already seen is being added to the store.
var RelayKeyFunc = func(st *sharetoken.T) (k1, k2, k3 string) {
return st.Contract.PublicKey.String(), st.PublicKey.String(), st.Signature.String()
}
RelayKeyFunc is the standard key derivation function for relays. The store is organized as such: servicekey public key -> service contract public key -> sharetoken signature + .json
Functions ¶
This section is empty.
Types ¶
type KeyFunc ¶
type KeyFunc func(*sharetoken.T) (string, string, string)
KeyFunc is the type of key derivation functions for this sharetoken store. On taking a sharetoken as argument it should produce keys of 1st, 2nd and 3rd order.
type T ¶
type T struct {
// contains filtered or unexported fields
}
T is the type of a sharetoken store.
func New ¶
New initializes a sharetoken store in the directory under the path given by the dir argument.
func (*T) Add ¶
func (t *T) Add(st *sharetoken.T) (err error)
Add adds a sharetoken (st) to the map of accumulated sharetokens under the keys generated by t.keyf. It returns DuplicateSTError if this sharetoken was already seen.
func (*T) Del ¶
func (t *T) Del(st *sharetoken.T) (err error)
Del deletes a sharetoken (st) from the map of accumulated sharetokens under the keys generated by t.keyf. It can return errors from attempting to delete the file associated with the sharetoken on disk.