9d2c430138
Different maps have different parameters now so we just construct/load them manually where needed.
30 lines
635 B
Go
30 lines
635 B
Go
package adt
|
|
|
|
import (
|
|
"github.com/ipfs/go-cid"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
"github.com/filecoin-project/go-state-types/cbor"
|
|
)
|
|
|
|
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 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
|
|
}
|