diff

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AmtParallelWorkerEnv = "LILY_AMT_PARALLEL_WORKER_LIMIT"
View Source
const HamtParallelWorkerEnv = "LILY_HAMT_PARALLEL_WORKER_LIMIT"

Variables

View Source
var AmtParallelWorkerLimit int64
View Source
var HamtParallelWorkerLimit int64

Functions

func Amt

func Amt(ctx context.Context, preArr, curArr adt2.Array, preStore, curStore adt.Store, amtOpts ...amt.Option) ([]*amt.Change, error)

Amt returns a set of changes that transform `preArr` into `curArr`. opts are applied to both `preArr` and `curArr`.

func CompareArray

func CompareArray(preArr, curArr adt.Array, out ArrayDiffer) error

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

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

If `preArr` and `curArr` are both backed by /v3/AMTs with the same bitwidth use the more efficient Amt method.

func CompareMap

func CompareMap(preMap, curMap adt.Map, out MapDiffer) error

CompareMap accepts two *adt.Map's and an MapDiffer implementation. It does the following: - All values that exist in preMap and not in curMap are passed to MapDiffer.Remove() - All values that exist in curMap nnd not in prevArr are passed to MapDiffer.Add() - All values that exist in preMap and in curMap are passed to MapDiffer.Modify()

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

If `preMap` and `curMap` are both backed by /v3/HAMTs with the same bitwidth and hash function use the more efficient Hamt method.

func Hamt

func Hamt(ctx context.Context, preMap, curMap adt2.Map, preStore, curStore adt.Store, hamtOpts ...hamt.Option) ([]*hamt.Change, error)

Hamt returns a set of changes that transform `preMap` into `curMap`. opts are applied to both `preMap` and `curMap`.

Types

type ArrayDiffer

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

ArrayDiffer 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 MapDiffer

type MapDiffer 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
}

MapDiffer 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

Jump to

Keyboard shortcuts

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