Documentation
¶
Overview ¶
Package entry defines the Entry structure for IPFS Log and its associated methods.
Index ¶
- func Difference(a []iface.IPFSLogEntry, b []iface.IPFSLogEntry) []iface.IPFSLogEntry
- func FetchAll(ctx context.Context, ipfs io.IpfsServices, hashes []cid.Cid, ...) []iface.IPFSLogEntry
- func FetchParallel(ctx context.Context, ipfs io.IpfsServices, hashes []cid.Cid, ...) []iface.IPFSLogEntry
- func FindChildren(entry iface.IPFSLogEntry, values []iface.IPFSLogEntry) []iface.IPFSLogEntry
- func FindHeads(entries iface.IPFSLogOrderedEntries) []iface.IPFSLogEntry
- func NewOrderedMap() iface.IPFSLogOrderedEntries
- func NewOrderedMapFromEntries(entries []iface.IPFSLogEntry) iface.IPFSLogOrderedEntries
- type CborEntry
- type CborLamportClock
- type Entry
- func (e *Entry) Equals(b *Entry) bool
- func (e *Entry) GetClock() iface.IPFSLogLamportClock
- func (e *Entry) GetHash() cid.Cid
- func (e *Entry) GetIdentity() *identityprovider.Identity
- func (e *Entry) GetKey() []byte
- func (e *Entry) GetLogID() string
- func (e *Entry) GetNext() []cid.Cid
- func (e *Entry) GetPayload() []byte
- func (e *Entry) GetSig() []byte
- func (e *Entry) GetV() uint64
- func (e *Entry) IsParent(b iface.IPFSLogEntry) bool
- func (e *Entry) IsValid() bool
- func (e *Entry) SetClock(clock iface.IPFSLogLamportClock)
- func (e *Entry) SetHash(hash cid.Cid)
- func (e *Entry) SetIdentity(identity *identityprovider.Identity)
- func (e *Entry) SetKey(key []byte)
- func (e *Entry) SetLogID(logID string)
- func (e *Entry) SetNext(next []cid.Cid)
- func (e *Entry) SetPayload(payload []byte)
- func (e *Entry) SetSig(sig []byte)
- func (e *Entry) SetV(v uint64)
- func (e *Entry) ToCborEntry() interface{}
- func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance io.IpfsServices) (cid.Cid, error)
- func (e *Entry) Verify(identity identityprovider.Interface) error
- type FetchOptions
- type Hashable
- type LamportClock
- func (l *LamportClock) Compare(b iface.IPFSLogLamportClock) int
- func (l *LamportClock) GetID() []byte
- func (l *LamportClock) GetTime() int
- func (l *LamportClock) Merge(clock iface.IPFSLogLamportClock) iface.IPFSLogLamportClock
- func (l *LamportClock) Tick() iface.IPFSLogLamportClock
- func (l *LamportClock) ToCborLamportClock() *iface.CborLamportClock
- type OrderedMap
- func (o *OrderedMap) At(index uint) iface.IPFSLogEntry
- func (o *OrderedMap) Copy() iface.IPFSLogOrderedEntries
- func (o *OrderedMap) Delete(key string)
- func (o *OrderedMap) Get(key string) (iface.IPFSLogEntry, bool)
- func (o *OrderedMap) Keys() []string
- func (o *OrderedMap) Len() int
- func (o *OrderedMap) Merge(other iface.IPFSLogOrderedEntries) iface.IPFSLogOrderedEntries
- func (o *OrderedMap) Set(key string, value iface.IPFSLogEntry)
- func (o *OrderedMap) Slice() []iface.IPFSLogEntry
- func (o *OrderedMap) Sort(lessFunc func(a *orderedmap.Pair, b *orderedmap.Pair) bool)
- func (o *OrderedMap) SortKeys(sortFunc func(keys []string))
- func (o *OrderedMap) UnsafeGet(key string) iface.IPFSLogEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Difference ¶
func Difference(a []iface.IPFSLogEntry, b []iface.IPFSLogEntry) []iface.IPFSLogEntry
Difference gets the list of values not present in both entries sets.
func FetchAll ¶
func FetchAll(ctx context.Context, ipfs io.IpfsServices, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry
FetchAll gets entries from their CIDs.
func FetchParallel ¶
func FetchParallel(ctx context.Context, ipfs io.IpfsServices, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry
FetchParallel retrieves IPFS log entries.
func FindChildren ¶
func FindChildren(entry iface.IPFSLogEntry, values []iface.IPFSLogEntry) []iface.IPFSLogEntry
FindChildren finds an entry's children from an Array of entries.
Returns entry's children as an Array up to the last know child.
func FindHeads ¶
func FindHeads(entries iface.IPFSLogOrderedEntries) []iface.IPFSLogEntry
FindHeads search entries heads in an OrderedMap.
func NewOrderedMap ¶
func NewOrderedMap() iface.IPFSLogOrderedEntries
NewOrderedMap creates a new OrderedMap of entries.
func NewOrderedMapFromEntries ¶
func NewOrderedMapFromEntries(entries []iface.IPFSLogEntry) iface.IPFSLogOrderedEntries
NewOrderedMapFromEntries creates a new OrderedMap of entries from a slice.
Types ¶
type CborEntry ¶
type CborEntry struct { V uint64 LogID string Key string Sig string Hash interface{} Next []cid.Cid Clock *CborLamportClock Payload string Identity *identityprovider.CborIdentity }
CborEntry CBOR representable version of Entry
type CborLamportClock ¶
type CborLamportClock = iface.CborLamportClock
type Entry ¶
type Entry struct { Payload []byte `json:"payload,omitempty"` LogID string `json:"id,omitempty"` Next []cid.Cid `json:"next,omitempty"` V uint64 `json:"v,omitempty"` Key []byte `json:"key,omitempty"` Sig []byte `json:"sig,omitempty"` Identity *identityprovider.Identity `json:"identity,omitempty"` Hash cid.Cid `json:"hash,omitempty"` Clock *LamportClock `json:"clock,omitempty"` }
func CreateEntry ¶
func CreateEntry(ctx context.Context, ipfsInstance io.IpfsServices, identity *identityprovider.Identity, data *Entry, clock iface.IPFSLogLamportClock) (*Entry, error)
CreateEntry creates an Entry.
func (*Entry) GetClock ¶
func (e *Entry) GetClock() iface.IPFSLogLamportClock
func (*Entry) GetIdentity ¶
func (e *Entry) GetIdentity() *identityprovider.Identity
func (*Entry) GetPayload ¶
func (*Entry) SetClock ¶
func (e *Entry) SetClock(clock iface.IPFSLogLamportClock)
func (*Entry) SetIdentity ¶
func (e *Entry) SetIdentity(identity *identityprovider.Identity)
func (*Entry) SetPayload ¶
func (*Entry) ToCborEntry ¶
func (e *Entry) ToCborEntry() interface{}
ToCborEntry creates a CBOR serializable version of an entry
func (*Entry) ToMultihash ¶
ToMultihash gets the multihash of an Entry.
type FetchOptions ¶
type FetchOptions = iface.FetchOptions
type LamportClock ¶
func NewLamportClock ¶
func NewLamportClock(identity []byte, time int) *LamportClock
NewLamportClock creates a new LamportClock instance.
func ToLamportClock ¶
func ToLamportClock(c *CborLamportClock) (*LamportClock, error)
func (*LamportClock) Compare ¶
func (l *LamportClock) Compare(b iface.IPFSLogLamportClock) int
Compare calculate the "distance" based on the clock, ie. lower or greater.
func (*LamportClock) GetID ¶
func (l *LamportClock) GetID() []byte
func (*LamportClock) GetTime ¶
func (l *LamportClock) GetTime() int
func (*LamportClock) Merge ¶
func (l *LamportClock) Merge(clock iface.IPFSLogLamportClock) iface.IPFSLogLamportClock
Merge fusion two LamportClocks.
func (*LamportClock) Tick ¶
func (l *LamportClock) Tick() iface.IPFSLogLamportClock
Tick increments the time value, returns a new instance of LamportClock.
func (*LamportClock) ToCborLamportClock ¶
func (l *LamportClock) ToCborLamportClock() *iface.CborLamportClock
type OrderedMap ¶
type OrderedMap struct {
// contains filtered or unexported fields
}
OrderedMap is an ordered map of entries.
func (*OrderedMap) At ¶
func (o *OrderedMap) At(index uint) iface.IPFSLogEntry
At gets an item at the given index in the map, returns nil if not found.
func (*OrderedMap) Copy ¶
func (o *OrderedMap) Copy() iface.IPFSLogOrderedEntries
Copy creates a copy of an OrderedMap.
func (*OrderedMap) Delete ¶
func (o *OrderedMap) Delete(key string)
Delete removes an Entry from the map for a given key.
func (*OrderedMap) Get ¶
func (o *OrderedMap) Get(key string) (iface.IPFSLogEntry, bool)
Get retrieves an Entry using its key.
func (*OrderedMap) Keys ¶
func (o *OrderedMap) Keys() []string
Keys retrieves the ordered list of keys in the map.
func (*OrderedMap) Merge ¶
func (o *OrderedMap) Merge(other iface.IPFSLogOrderedEntries) iface.IPFSLogOrderedEntries
Merge will fusion two OrderedMap of entries.
func (*OrderedMap) Set ¶
func (o *OrderedMap) Set(key string, value iface.IPFSLogEntry)
Set defines an Entry in the map for a given key.
func (*OrderedMap) Slice ¶
func (o *OrderedMap) Slice() []iface.IPFSLogEntry
Slice returns an ordered slice of the values existing in the map.
func (*OrderedMap) Sort ¶
func (o *OrderedMap) Sort(lessFunc func(a *orderedmap.Pair, b *orderedmap.Pair) bool)
Sort orders the map using your sort func.
func (*OrderedMap) SortKeys ¶
func (o *OrderedMap) SortKeys(sortFunc func(keys []string))
SortKeys orders the map keys using your sort func.
func (*OrderedMap) UnsafeGet ¶
func (o *OrderedMap) UnsafeGet(key string) iface.IPFSLogEntry
UnsafeGet retrieves an Entry using its key, returns nil if not found.