adt

package
v1.31.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 62

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffAdtArray

func DiffAdtArray(preArr, curArr Array, out AdtArrayDiff) error

DiffAdtArray accepts two *adt.Array's and an AdtArrayDiff implementation. It does the following: - All values that exist in preArr and not in curArr are passed to AdtArrayDiff.Remove() - All values that exist in curArr nnd not in prevArr are passed to adtArrayDiff.Add() - All values that exist in preArr and in curArr are passed to AdtArrayDiff.Modify()

  • It is the responsibility of AdtArrayDiff.Modify() to determine if the values it was passed have been modified.

func DiffAdtMap

func DiffAdtMap(preMap, curMap Map, out AdtMapDiff) error

Types

type AdtArrayDiff

type AdtArrayDiff interface {
	Add(key uint64, val *typegen.Deferred) error
	Modify(key uint64, from, to *typegen.Deferred) error
	Remove(key uint64, val *typegen.Deferred) error
}

AdtArrayDiff generalizes adt.Array diffing by accepting a Deferred type that can unmarshalled to its corresponding struct in an interface implantation. Add should be called when a new k,v is added to the array Modify should be called when a value is modified in the array Remove should be called when a value is removed from the array

type AdtMapDiff

type AdtMapDiff interface {
	AsKey(key string) (abi.Keyer, error)
	Add(key string, val *typegen.Deferred) error
	Modify(key string, from, to *typegen.Deferred) error
	Remove(key string, val *typegen.Deferred) error
}

AdtMapDiff generalizes adt.Map diffing by accepting a Deferred type that can unmarshalled to its corresponding struct in an interface implantation. AsKey should return the Keyer implementation specific to the map Add should be called when a new k,v is added to the map Modify should be called when a value is modified in the map Remove should be called when a value is removed from the map

type Array

type Array interface {
	Root() (cid.Cid, error)

	Set(idx uint64, v cbor.Marshaler) error
	Get(idx uint64, v cbor.Unmarshaler) (bool, error)
	Delete(idx uint64) error
	Length() uint64

	ForEach(v cbor.Unmarshaler, fn func(idx int64) error) error
}

type Map

type Map interface {
	Root() (cid.Cid, error)

	Put(k abi.Keyer, v cbor.Marshaler) error
	Get(k abi.Keyer, v cbor.Unmarshaler) (bool, error)
	Delete(k abi.Keyer) error

	ForEach(v cbor.Unmarshaler, fn func(key string) error) error
}

type Store

type Store interface {
	Context() context.Context
	cbor.IpldStore
}

func WrapStore

func WrapStore(ctx context.Context, store cbor.IpldStore) Store

Jump to

Keyboard shortcuts

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