iface

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2019 License: Apache-2.0, MIT Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CborLamportClock

type CborLamportClock struct {
	ID   string
	Time int
}

type FetchOptions

type FetchOptions struct {
	Length       *int
	Exclude      []IPFSLogEntry
	Concurrency  int
	Timeout      time.Duration
	ProgressChan chan IPFSLogEntry
	Provider     identityprovider.Interface
}

type IPFSLog

type IPFSLog interface {
	GetID() string
	Append(ctx context.Context, payload []byte, pointerCount int) (IPFSLogEntry, error)
	Iterator(options *IteratorOptions, output chan<- IPFSLogEntry) error
	Join(otherLog IPFSLog, size int) (IPFSLog, error)
	ToString(payloadMapper func(IPFSLogEntry) string) string
	ToSnapshot() *Snapshot
	ToMultihash(ctx context.Context) (cid.Cid, error)
	Values() IPFSLogOrderedEntries
	ToJSON() *JSONLog
	Heads() IPFSLogOrderedEntries
	GetEntries() IPFSLogOrderedEntries
	SetEntries(IPFSLogOrderedEntries)
	RawHeads() IPFSLogOrderedEntries
}

type IPFSLogEntry

type IPFSLogEntry interface {
	accesscontroller.LogEntry

	GetLogID() string
	GetNext() []cid.Cid
	GetV() uint64
	GetKey() []byte
	GetSig() []byte
	GetHash() cid.Cid
	GetClock() IPFSLogLamportClock

	SetPayload([]byte)
	SetLogID(string)
	SetNext([]cid.Cid)
	SetV(uint64)
	SetKey([]byte)
	SetSig([]byte)
	SetIdentity(*identityprovider.Identity)
	SetHash(cid.Cid)
	SetClock(IPFSLogLamportClock)

	IsValid() bool
	Verify(identity identityprovider.Interface) error
	IsParent(b IPFSLogEntry) bool
	ToCborEntry() interface{}
}

type IPFSLogLamportClock

type IPFSLogLamportClock interface {
	GetID() []byte
	GetTime() int

	Tick() IPFSLogLamportClock
	Merge(clock IPFSLogLamportClock) IPFSLogLamportClock
	Compare(b IPFSLogLamportClock) int

	ToCborLamportClock() *CborLamportClock
}

type IPFSLogOrderedEntries

type IPFSLogOrderedEntries interface {
	// Merge will fusion two OrderedMap of entries.
	Merge(other IPFSLogOrderedEntries) IPFSLogOrderedEntries

	// Copy creates a copy of an OrderedMap.
	Copy() IPFSLogOrderedEntries

	// Get retrieves an Entry using its key.
	Get(key string) (IPFSLogEntry, bool)

	// UnsafeGet retrieves an Entry using its key, returns nil if not found.
	UnsafeGet(key string) IPFSLogEntry

	// Set defines an Entry in the map for a given key.
	Set(key string, value IPFSLogEntry)

	// Slice returns an ordered slice of the values existing in the map.
	Slice() []IPFSLogEntry

	// Delete removes an Entry from the map for a given key.
	Delete(key string)

	// Keys retrieves the ordered list of keys in the map.
	Keys() []string

	// SortKeys orders the map keys using your sort func.
	SortKeys(sortFunc func(keys []string))

	// Sort orders the map using your sort func.
	Sort(lessFunc func(a *orderedmap.Pair, b *orderedmap.Pair) bool)

	// Len gets the length of the map.
	Len() int

	// At gets an item at the given index in the map, returns nil if not found.
	At(index uint) IPFSLogEntry
}

type IteratorOptions

type IteratorOptions struct {
	GT     *cid.Cid
	GTE    *cid.Cid
	LT     []cid.Cid
	LTE    []cid.Cid
	Amount *int
}

type JSONLog

type JSONLog struct {
	ID    string
	Heads []cid.Cid
}

type LogOptions

type LogOptions struct {
	ID               string
	AccessController accesscontroller.Interface
	Entries          IPFSLogOrderedEntries
	Heads            []IPFSLogEntry
	Clock            IPFSLogLamportClock
	SortFn           func(a, b IPFSLogEntry) (int, error)
}

type Snapshot

type Snapshot struct {
	ID     string
	Heads  []cid.Cid
	Values []IPFSLogEntry
	Clock  IPFSLogLamportClock
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL