Documentation ¶
Overview ¶
Package entry defines the Entry structure for IPFS Log and its associated methods.
Index ¶
- func CreateEntry(ctx context.Context, ipfsInstance core_iface.CoreAPI, ...) (iface.IPFSLogEntry, error)
- func CreateEntryWithIO(ctx context.Context, ipfsInstance core_iface.CoreAPI, ...) (iface.IPFSLogEntry, error)
- func Difference(a []iface.IPFSLogEntry, b []iface.IPFSLogEntry) []iface.IPFSLogEntry
- func FetchAll(ctx context.Context, ipfs core_iface.CoreAPI, hashes []cid.Cid, ...) []iface.IPFSLogEntry
- func FetchParallel(ctx context.Context, ipfs core_iface.CoreAPI, hashes []cid.Cid, ...) []iface.IPFSLogEntry
- func FindChildren(entry iface.IPFSLogEntry, values []iface.IPFSLogEntry) []iface.IPFSLogEntry
- func FindHeads(entries iface.IPFSLogOrderedEntries) []iface.IPFSLogEntry
- func FromMultihash(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, ...) (iface.IPFSLogEntry, error)
- func FromMultihashWithIO(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, ...) (iface.IPFSLogEntry, error)
- func NewOrderedMap() iface.IPFSLogOrderedEntries
- func NewOrderedMapFromEntries(entries []iface.IPFSLogEntry) iface.IPFSLogOrderedEntries
- func ToHashable(e iface.IPFSLogEntry) (*iface.Hashable, error)
- func ToMultihashWithIO(ctx context.Context, e iface.IPFSLogEntry, ipfsInstance core_iface.CoreAPI, ...) (cid.Cid, error)
- type Entry
- func (e *Entry) Copy() iface.IPFSLogEntry
- func (e *Entry) Defined() bool
- func (e *Entry) Equals(b iface.IPFSLogEntry) bool
- func (e *Entry) GetAdditionalData() map[string]string
- 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) GetRefs() []cid.Cid
- 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) New() iface.IPFSLogEntry
- func (e *Entry) SetAdditionalDataValue(key string, value string)
- 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) SetRefs(refs []cid.Cid)
- func (e *Entry) SetSig(sig []byte)
- func (e *Entry) SetV(v uint64)
- func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance core_iface.CoreAPI, ...) (cid.Cid, error)
- func (e *Entry) Verify(identity identityprovider.Interface, io iface.IO) error
- type FetchOptions
- type Fetcher
- type LamportClock
- func (l *LamportClock) Compare(b iface.IPFSLogLamportClock) int
- func (l *LamportClock) Defined() bool
- func (l *LamportClock) GetID() []byte
- func (l *LamportClock) GetTime() int
- func (l *LamportClock) Merge(clock iface.IPFSLogLamportClock) iface.IPFSLogLamportClock
- func (l *LamportClock) New() iface.IPFSLogLamportClock
- func (l *LamportClock) SetID(i []byte)
- func (l *LamportClock) SetTime(i int)
- func (l *LamportClock) Tick() iface.IPFSLogLamportClock
- type OrderedMap
- func (o *OrderedMap) At(index uint) iface.IPFSLogEntry
- func (o *OrderedMap) Copy() iface.IPFSLogOrderedEntries
- 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) Reverse() iface.IPFSLogOrderedEntries
- func (o *OrderedMap) Set(key string, value iface.IPFSLogEntry)
- func (o *OrderedMap) Slice() []iface.IPFSLogEntry
- func (o *OrderedMap) UnsafeGet(key string) iface.IPFSLogEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateEntry ¶
func CreateEntry(ctx context.Context, ipfsInstance core_iface.CoreAPI, identity *identityprovider.Identity, data *Entry, opts *iface.CreateEntryOptions) (iface.IPFSLogEntry, error)
func CreateEntryWithIO ¶
func CreateEntryWithIO(ctx context.Context, ipfsInstance core_iface.CoreAPI, identity *identityprovider.Identity, data iface.IPFSLogEntry, opts *iface.CreateEntryOptions, io iface.IO) (iface.IPFSLogEntry, error)
CreateEntryWithIO creates an Entry.
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 core_iface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry
FetchAll gets entries from their CIDs.
func FetchParallel ¶
func FetchParallel(ctx context.Context, ipfs core_iface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry
FetchParallel has the same comportement than FetchAll, we keep it for retrop compatibility purpose
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 FromMultihash ¶
func FromMultihash(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, provider identityprovider.Interface) (iface.IPFSLogEntry, error)
FromMultihash creates an Entry from a hash.
func FromMultihashWithIO ¶
func FromMultihashWithIO(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, provider identityprovider.Interface, io iface.IO) (iface.IPFSLogEntry, error)
FromMultihashWithIO creates an Entry from a hash.
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.
func ToHashable ¶
func ToHashable(e iface.IPFSLogEntry) (*iface.Hashable, error)
ToHashable Converts an entry to hashable.
func ToMultihashWithIO ¶
func ToMultihashWithIO(ctx context.Context, e iface.IPFSLogEntry, ipfsInstance core_iface.CoreAPI, opts *iface.CreateEntryOptions, io iface.IO) (cid.Cid, error)
ToMultihashWithIO gets the multihash of an Entry.
Types ¶
type Entry ¶
type Entry struct { Payload []byte `json:"payload,omitempty"` LogID string `json:"id,omitempty"` Next []cid.Cid `json:"next,omitempty"` Refs []cid.Cid `json:"refs,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"` AdditionalData map[string]string `json:"-"` }
func Normalize ¶
func Normalize(e iface.IPFSLogEntry, opts *normalizeEntryOpts) *Entry
func (*Entry) Equals ¶
func (e *Entry) Equals(b iface.IPFSLogEntry) bool
Equals checks that two entries are identical.
func (*Entry) GetAdditionalData ¶
func (*Entry) GetClock ¶
func (e *Entry) GetClock() iface.IPFSLogLamportClock
func (*Entry) GetIdentity ¶
func (e *Entry) GetIdentity() *identityprovider.Identity
func (*Entry) GetPayload ¶
func (*Entry) New ¶
func (e *Entry) New() iface.IPFSLogEntry
func (*Entry) SetAdditionalDataValue ¶
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) ToMultihash ¶
func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance core_iface.CoreAPI, opts *iface.CreateEntryOptions) (cid.Cid, error)
ToMultihash gets the multihash of an Entry.
type FetchOptions ¶
type FetchOptions = iface.FetchOptions
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
func NewFetcher ¶
func NewFetcher(ipfs core_iface.CoreAPI, options *FetchOptions) *Fetcher
type LamportClock ¶
func CopyLamportClock ¶
func CopyLamportClock(clock iface.IPFSLogLamportClock) *LamportClock
CopyLamportClock returns a copy of a lamport clock
func NewLamportClock ¶
func NewLamportClock(identity []byte, time int) *LamportClock
NewLamportClock creates a new LamportClock instance.
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) Defined ¶
func (l *LamportClock) Defined() bool
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) New ¶
func (l *LamportClock) New() iface.IPFSLogLamportClock
func (*LamportClock) SetID ¶
func (l *LamportClock) SetID(i []byte)
func (*LamportClock) SetTime ¶
func (l *LamportClock) SetTime(i int)
func (*LamportClock) Tick ¶
func (l *LamportClock) Tick() iface.IPFSLogLamportClock
Tick increments the time value, returns a new instance of LamportClock.
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
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) Reverse ¶
func (o *OrderedMap) Reverse() iface.IPFSLogOrderedEntries
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) UnsafeGet ¶
func (o *OrderedMap) UnsafeGet(key string) iface.IPFSLogEntry
UnsafeGet retrieves an Entry using its key, returns nil if not found.