Documentation ¶
Overview ¶
Package entry defines the Entry structure for IPFS Log and its associated methods.
Index ¶
- func CreateEntry(ctx context.Context, ipfsInstance coreiface.CoreAPI, ...) (iface.IPFSLogEntry, error)
- func CreateEntryWithIO(ctx context.Context, ipfsInstance coreiface.CoreAPI, ...) (iface.IPFSLogEntry, error)
- func Difference(a []iface.IPFSLogEntry, b []iface.IPFSLogEntry) []iface.IPFSLogEntry
- func FetchAll(ctx context.Context, ipfs coreiface.CoreAPI, hashes []cid.Cid, ...) []iface.IPFSLogEntry
- func FetchParallel(ctx context.Context, ipfs coreiface.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 coreiface.CoreAPI, hash cid.Cid, ...) (iface.IPFSLogEntry, error)
- func FromMultihashWithIO(ctx context.Context, ipfs coreiface.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 coreiface.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 coreiface.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 coreiface.CoreAPI, identity *identityprovider.Identity, data *Entry, opts *iface.CreateEntryOptions) (iface.IPFSLogEntry, error)
func CreateEntryWithIO ¶ added in v1.3.0
func CreateEntryWithIO(ctx context.Context, ipfsInstance coreiface.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 coreiface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry
FetchAll gets entries from their CIDs.
func FetchParallel ¶
func FetchParallel(ctx context.Context, ipfs coreiface.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 ¶ added in v1.1.0
func FromMultihash(ctx context.Context, ipfs coreiface.CoreAPI, hash cid.Cid, provider identityprovider.Interface) (iface.IPFSLogEntry, error)
FromMultihash creates an Entry from a hash.
func FromMultihashWithIO ¶ added in v1.3.0
func FromMultihashWithIO(ctx context.Context, ipfs coreiface.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 ¶ added in v1.3.0
func ToHashable(e iface.IPFSLogEntry) (*iface.Hashable, error)
ToHashable Converts an entry to hashable.
func ToMultihashWithIO ¶ added in v1.3.0
func ToMultihashWithIO(ctx context.Context, e iface.IPFSLogEntry, ipfsInstance coreiface.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 ¶ added in v1.3.0
func Normalize(e iface.IPFSLogEntry, opts *normalizeEntryOpts) *Entry
func (*Entry) Copy ¶ added in v1.3.0
func (e *Entry) Copy() iface.IPFSLogEntry
Copy creates a copy of an entry.
func (*Entry) Equals ¶
func (e *Entry) Equals(b iface.IPFSLogEntry) bool
Equals checks that two entries are identical.
func (*Entry) GetAdditionalData ¶ added in v1.3.0
func (*Entry) GetClock ¶
func (e *Entry) GetClock() iface.IPFSLogLamportClock
func (*Entry) GetIdentity ¶
func (e *Entry) GetIdentity() *identityprovider.Identity
func (*Entry) GetPayload ¶
func (*Entry) New ¶ added in v1.3.0
func (e *Entry) New() iface.IPFSLogEntry
func (*Entry) SetAdditionalDataValue ¶ added in v1.3.0
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 coreiface.CoreAPI, opts *iface.CreateEntryOptions) (cid.Cid, error)
ToMultihash gets the multihash of an Entry.
type FetchOptions ¶
type FetchOptions = iface.FetchOptions
type Fetcher ¶ added in v1.7.0
type Fetcher struct {
// contains filtered or unexported fields
}
func NewFetcher ¶ added in v1.7.0
func NewFetcher(ipfs coreiface.CoreAPI, options *FetchOptions) *Fetcher
type LamportClock ¶
func CopyLamportClock ¶ added in v1.1.0
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 ¶ added in v1.3.0
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 ¶ added in v1.3.0
func (l *LamportClock) New() iface.IPFSLogLamportClock
func (*LamportClock) SetID ¶ added in v1.3.0
func (l *LamportClock) SetID(i []byte)
func (*LamportClock) SetTime ¶ added in v1.3.0
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 ¶ added in v1.1.0
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.