storage.bend relies on unsafe/foreign
raw source on the hub · import bend-kit-storage@0.2.0.1/storage.bend as Storage
Content-addressed object store: Merkle trees, sync plans, and reachability GC with proved laws. Source: https://github.com/paymog/bend-kit/tree/main/storage
6 imports
import Base import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes import bend-kit-files@0.3.1.0/files.bend as Files import bend-kit-crypto@0.2.2.2/crypto.bend as Crypto import bend-kit-collections@0.1.5.0/omap.bend as OMap import bend-kit-collections@0.1.5.0/order.bend as Order
Types
type Tree source · line 10 · raw
@-B:Data -> Data
The content: a file, or a directory as a chain of named entries that ends in End.
TFile@-B:Data -> @data:B -> Tree<B>
TEnd@-B:Data -> Tree<B>
TItem@-B:Data -> @name:String -> @child:Tree<B> -> @rest:Tree<B> -> Tree<B>
type Obj source · line 16 · raw
@-D:Data -> @-B:Data -> Data
One stored object. An OItem names its child and the rest of its directory by digest.
OFile@-D:Data -> @-B:Data -> @data:B -> Obj<D, B>
OEnd@-D:Data -> @-B:Data -> Obj<D, B>
OItem@-D:Data -> @-B:Data -> @name:String -> @child:D -> @rest:D -> Obj<D, B>
type Store source · line 23 · raw
@-D:Data -> @-B:Data -> Data
Objects by digest, as a list: the model the laws reason about. get answers the first entry whose digest eq accepts. Index below answers the same in O(log n) comparisons.
StNil@-D:Data -> @-B:Data -> Store<D, B>
StCon@-D:Data -> @-B:Data -> @key:D -> @obj:Obj<D, B> -> @rest:Store<D, B> -> Store<D, B>
type Blob source · line 407 · raw
Data
Octets packed four to a U32, low byte first, as Bytes packs them. Words past len are 0.
Blob@len:U32 -> @words:List<&2, U32> -> Blob
type Step source · line 880 · raw
Data
StatStep
Statted@info:0xc022f29d7abb4bf4d2f497d0b5159f5a/files.Info -> Step
Listing@names:List<&2, String> -> Step
Definitions
def Store.new source · line 27 · raw
@-D:Data -> @-B:Data -> Store<D, B>
def Store.put.if source · line 54 · raw
@-D:Data -> @-B:Data -> @found:Bool -> @s:Store<D, B> -> @d:D -> @o:Obj<D, B> -> Store<D, B>
def Store.size source · line 73 · raw
@-D:Data -> @-B:Data -> @s:Store<D, B> -> U32
def Store.cat source · line 81 · raw
@-D:Data -> @-B:Data -> @xs:Store<D, B> -> @ys:Store<D, B> -> Store<D, B>
xs, then ys.
def Tree.item source · line 89 · raw
@-B:Data -> @n:String -> @c:Maybe<&2, Tree<B>> -> @r:Maybe<&2, Tree<B>> -> Maybe<&2, Tree<B>>
Some only when both halves loaded.
def closure.item source · line 116 · raw
@-D:Data -> @-B:Data -> @d:D -> @o:Obj<D, B> -> @c:Maybe<&2, Store<D, B>> -> @r:Maybe<&2, Store<D, B>> -> Maybe<&2, Store<D, B>>
def live.cat source · line 178 · raw
@-D:Data -> @-B:Data -> @a:Maybe<&2, Store<D, B>> -> @b:Maybe<&2, Store<D, B>> -> Maybe<&2, Store<D, B>>
def keep.if source · line 203 · raw
@-D:Data -> @-B:Data -> @live:Bool -> @k:D -> @o:Obj<D, B> -> @r:Store<D, B> -> Store<D, B>
def admit.if source · line 229 · raw
@-D:Data -> @-B:Data -> @ok:Bool -> @s:Store<D, B> -> @keep:Store<D, B> -> Maybe<&2, Store<D, B>>
def fits source · line 263 · raw
@-B:Data -> @fuel:Nat -> @t:Tree<B> -> Bool
True when load with this fuel reaches every node of t.
def Index source · line 285 · raw
@-D:Data -> @-B:Data -> Data
def Index.new source · line 288 · raw
@-D:Data -> @-B:Data -> Index(D, B)
def Index.size source · line 291 · raw
@-D:Data -> @-B:Data -> @m:Index(D, B) -> U32
def Index.admit.if source · line 393 · raw
@-D:Data -> @-B:Data -> @ok:Bool -> @s:Index(D, B) -> Maybe<&2, Index(D, B)>
def Blob.read source · line 411 · raw
@n:Nat -> @r:Pair(Array<U32>, U32) -> @+i:U32 -> @acc:List<&2, U32> -> List<&2, U32>
r is the array beside the word read at i - 1.
def Blob.of source · line 419 · raw
@b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Blob
def Blob.write source · line 423 · raw
@ws:List<&2, U32> -> @a:Array<U32> -> @+i:U32 -> Array<U32>
def Blob.bytes source · line 430 · raw
@x:Blob -> 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes
def Blob.write.last source · line 435 · raw
@zero:Bool -> @a:Array<U32> -> @+j:U32 -> @+carry:U32 -> Array<U32>
A zero last carry may lie past the array, where a write would wrap to word 0.
def Blob.write.shift source · line 443 · raw
@ws:List<&2, U32> -> @a:Array<U32> -> @+j:U32 -> @+lo:Nat -> @+hi:Nat -> @+carry:U32 -> Array<U32>
Writes ws from octet 4 * j + lo / 8 on; carry holds the octets of word j below lo.
def Blob.string source · line 450 · raw
@+s:String -> Blob
def limit source · line 454 · raw
Nat
Loads and collections give up past this many levels. Each directory entry is one level.
def char.ok source · line 457 · raw
@+c:U32 -> Bool
def chars.ok source · line 460 · raw
@s:String -> Bool
def name.ok source · line 468 · raw
@+n:String -> Bool
A directory entry name: one to 255 octets, not "." or "..", with no NUL, newline, or "/".
def hex.ok source · line 473 · raw
@s:String -> Bool
def digest.ok source · line 481 · raw
@+d:String -> Bool
64 lowercase hex characters.
def encode.file.at source · line 484 · raw
@+len:U32 -> @ws:List<&2, U32> -> @+hl:U32 -> @r:Pair(Array<U32>, U32) -> 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes
def encode.file.pick source · line 489 · raw
@aligned:Bool -> @+len:U32 -> @ws:List<&2, U32> -> @+hl:U32 -> @a:Array<U32> -> 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes
def encode.file source · line 497 · raw
@+len:U32 -> @ws:List<&2, U32> -> @h:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes
The header h, then the words of a Blob of len octets, written once without a byte loop.
def encode source · line 502 · raw
@o:Obj<String, Blob> -> 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes
The canonical encoding: "file <len>\n" and the octets, "end\n", or "item <child> <rest> <name>\n".
def decode.when source · line 512 · raw
@ok:Bool -> @o:Obj<String, Blob> -> Maybe<&2, Obj<String, Blob>>
def decode.item source · line 520 · raw
@+rest:String -> Maybe<&2, Obj<String, Blob>>
rest is "<child> <rest> <name>".
def decode.file source · line 528 · raw
@m:Maybe<&2, U32> -> @+digits:String -> @+at:U32 -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Maybe<&2, Obj<String, Blob>>
def decode.head source · line 537 · raw
@+head:String -> @+at:U32 -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Maybe<&2, Obj<String, Blob>>
def decode.cut source · line 546 · raw
@+at:U32 -> @r:Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes) -> Maybe<&2, Obj<String, Blob>>
def decode.at source · line 550 · raw
@r:Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, Maybe<&2, U32>) -> Maybe<&2, Obj<String, Blob>>
def decode source · line 558 · raw
@b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Maybe<&2, Obj<String, Blob>>
The object that encode wrote, or None for any other octets.
def Run source · line 563 · raw
@-A:Type -> Type
def Run.pure source · line 566 · raw
@-A:Type -> @x:A -> Run(A)
def Run.fail source · line 569 · raw
@-A:Type -> @e:Pair(U32, String) -> Run(A)
def Run.next source · line 572 · raw
@-A:Type -> @-B:Type -> @r:Result<&1, &1, Pair(U32, String), A> -> @f:(@_:A -> Run(B)) -> Run(B)
def Run.bind source · line 579 · raw
@-A:Type -> @-B:Type -> @m:Run(A) -> @f:(@_:A -> Run(B)) -> Run(B)
def Run.lift source · line 582 · raw
@-A:Type -> @m:IO(A) -> Run(A)
def Run.check source · line 585 · raw
@ok:Bool -> @+why:String -> Run(Unit)
def Run.some source · line 592 · raw
@-A:Data -> @m:Maybe<&2, A> -> @+why:String -> Run(A)
def digest.hex source · line 599 · raw
@r:Pair(U32, Array<U32>) -> String
def digest source · line 604 · raw
@b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(String)
The SHA-256 of b, as 64 lowercase hex characters.
def commit.done source · line 610 · raw
@+d:String -> @o:Obj<String, Blob> -> @xs:Store<String, Blob> -> Run(Pair(String, Store<String, Blob>))
def commit.node source · line 613 · raw
@+o:Obj<String, Blob> -> @xs:Store<String, Blob> -> Run(Pair(String, Store<String, Blob>))
def commit.item source · line 618 · raw
@+n:String -> @c:Pair(String, Store<String, Blob>) -> @r:Pair(String, Store<String, Blob>) -> Run(Pair(String, Store<String, Blob>))
def commit source · line 626 · raw
@t:Tree<Blob> -> Run(Pair(String, Store<String, Blob>))
hash and objects with H = SHA-256 of encode: the root digest and the objects, children first.
def receive.two source · line 638 · raw
@+s:Index(String, Blob) -> @+claimed:String -> @bb:Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes) -> Run(Index(String, Blob))
def receive source · line 646 · raw
@+s:Index(String, Blob) -> @+claimed:String -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(Index(String, Blob))
Ingress: the store with the object that b encodes. Fails when b does not decode or its SHA-256 is not claimed.
def Disk.object source · line 651 · raw
@+dir:String -> @+d:String -> String
def Disk.init source · line 654 · raw
@+dir:String -> Run(Unit)
def write.close source · line 660 · raw
@r:Pair(File, Result<&1, &1, Pair(U32, String), Unit>) -> Run(Unit)
def write.file source · line 667 · raw
@+path:String -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(Unit)
def write source · line 674 · raw
@+dir:String -> @+name:String -> @+path:String -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(Unit)
Writes b to path through dir/tmp and a rename, so a reader sees all of b or nothing.
def read.chunk source · line 680 · raw
@r:Pair(File, Result<&1, &1, Pair(U32, String), 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes>) -> Run(Pair(File, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes))
def read.piece source · line 689 · raw
@f:File -> Run(Pair(File, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes))
def read.go source · line 693 · raw
@n:Nat -> @fb:Pair(File, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes) -> @acc:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)
n more reads of up to 1 MiB each; fb holds the file and the last piece.
def read.check source · line 704 · raw
@+size:U32 -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)
def info.size source · line 710 · raw
@i:0xc022f29d7abb4bf4d2f497d0b5159f5a/files.Info -> U32
def read.sized source · line 714 · raw
@+path:String -> @+size:U32 -> Run(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)
def read source · line 721 · raw
@+path:String -> Run(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)
The whole file at path.
def Disk.put.if source · line 727 · raw
@there:Bool -> @+dir:String -> @+d:String -> @+path:String -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(Unit)
def Disk.put source · line 735 · raw
@+dir:String -> @+d:String -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(Unit)
Writes the encoded object under its digest unless the file exists. Objects never change.
def Disk.save source · line 741 · raw
@+dir:String -> @xs:Store<String, Blob> -> Run(Unit)
def Disk.receive.two source · line 751 · raw
@+dir:String -> @+s:Index(String, Blob) -> @+claimed:String -> @bb:Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes) -> Run(Index(String, Blob))
Ingress into the store at dir: receive, then write the octets under their digest.
def Disk.receive source · line 758 · raw
@+dir:String -> @+s:Index(String, Blob) -> @+claimed:String -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> Run(Index(String, Blob))
def Disk.load.go source · line 761 · raw
@+dir:String -> @names:List<&2, String> -> @+s:Index(String, Blob) -> Run(Index(String, Blob))
def Disk.load source · line 772 · raw
@+dir:String -> Run(Index(String, Blob))
Every object at dir, each checked against its file name. A tampered or undecodable object fails the load.
def Disk.set_root source · line 777 · raw
@+dir:String -> @+name:String -> @+d:String -> Run(Unit)
def Disk.root.of source · line 782 · raw
@+name:String -> @+d:String -> Run(String)
def Disk.root source · line 787 · raw
@+dir:String -> @+name:String -> Run(String)
def Disk.roots.go source · line 792 · raw
@+dir:String -> @names:List<&2, String> -> Run(List<&2, String>)
def Disk.roots source · line 803 · raw
@+dir:String -> Run(List<&2, String>)
The digest of every named root.
def Disk.drop.one source · line 808 · raw
@live:Bool -> @+dir:String -> @+d:String -> Run(U32)
def Disk.drop source · line 817 · raw
@+dir:String -> @ds:List<&2, String> -> @+live:Index(String, Blob) -> @+n:U32 -> Run(U32)
def Disk.collect.of source · line 827 · raw
@+dir:String -> @+retained:List<&2, String> -> @+s:Index(String, Blob) -> Run(U32)
Drops what gc drops: an object of s stays exactly when its digest is in the live set.
def Disk.collect source · line 834 · raw
@+dir:String -> @+retained:List<&2, String> -> Run(U32)
Deletes every object that no retained root reaches and answers how many it deleted. Fails, and deletes nothing, when a retained root does not load. No writer may run during the collection.
def sync.send source · line 839 · raw
@+dir:String -> @ys:Store<String, Blob> -> @+dst:Index(String, Blob) -> @+n:U32 -> Run(U32)
def sync.of source · line 848 · raw
@+dst:String -> @+root:String -> @+a:Index(String, Blob) -> @+b:Index(String, Blob) -> Run(U32)
def sync source · line 854 · raw
@+src:String -> @+dst:String -> @+root:String -> Run(U32)
Sends dst every object it needs to load root as src does, through ingress. Answers how many it sent.
def Disk.checkout source · line 861 · raw
@+dir:String -> @+root:String -> Run(Tree<Blob>)
The tree under root at dir. Fails when an object is missing or tampered, or the tree is too deep.
def Disk.commit.save source · line 866 · raw
@+dir:String -> @r:Pair(String, Store<String, Blob>) -> Run(String)
def Disk.commit source · line 873 · raw
@+dir:String -> @t:Tree<Blob> -> Run(String)
Commits t to the store at dir and answers its root digest.
def snap source · line 886 · raw
@fuel:Nat -> @+path:String -> @step:Step -> Run(Tree<Blob>)
The tree at path. Regular files become TFile and directories become TItem chains in name order.
def snapshot source · line 907 · raw
@+path:String -> Run(Tree<Blob>)
def restore.go source · line 911 · raw
@t:Tree<Blob> -> @+path:String -> @chain:Bool -> Run(Unit)
Writes t at path. chain is True when t is the rest of the listing of directory path.
def restore source · line 934 · raw
@t:Tree<Blob> -> @+path:String -> Run(Unit)
Writes t as a new file or directory at path. Fails if path exists.
Templates
template Store.head source · line 31 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @s:Store<D, B> -> @+d:D -> Bool
eq(d, first key), or False when s is empty.
template Store.get.go source · line 39 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @s:Store<D, B> -> @+d:D -> @hit:Bool -> Maybe<&2, Obj<D, B>>
hit is Store.head(s, d), so the walk stops at the first match.
template Store.get source · line 48 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @+s:Store<D, B> -> @+d:D -> Maybe<&2, Obj<D, B>>
template Store.has source · line 51 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @+s:Store<D, B> -> @+d:D -> Bool
template Store.put source · line 62 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @+s:Store<D, B> -> @+d:D -> @o:Obj<D, B> -> Store<D, B>
Adds o under d unless d is present. The first object under a digest stays.
template Store.apply source · line 66 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @xs:Store<D, B> -> @+s:Store<D, B> -> Store<D, B>
Puts each (digest, object) in order.
template load.go source · line 99 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @fuel:Nat -> @+s:Store<D, B> -> @m:Maybe<&2, Obj<D, B>> -> Maybe<&2, Tree<B>>
m is the object under the digest being loaded.
template load source · line 113 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @fuel:Nat -> @+s:Store<D, B> -> @+d:D -> Maybe<&2, Tree<B>>
The tree under d, or None when an object is missing or the tree is deeper than fuel.
template closure.go source · line 125 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @fuel:Nat -> @+s:Store<D, B> -> @+d:D -> @m:Maybe<&2, Obj<D, B>> -> Maybe<&2, Store<D, B>>
template closure source · line 141 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @fuel:Nat -> @+s:Store<D, B> -> @+d:D -> Maybe<&2, Store<D, B>>
Every object that load(fuel, s, d) reads, parents first, or None when load fails.
template need.head source · line 145 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @+t:Store<D, B> -> @xs:Store<D, B> -> Bool
Store.has(t, first digest of xs), or False when xs is empty.
template need.go source · line 153 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @xs:Store<D, B> -> @+t:Store<D, B> -> @found:Bool -> Store<D, B>
found is need.head(t, xs), so only the taken branch recurses.
template need source · line 164 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @+xs:Store<D, B> -> @+t:Store<D, B> -> Store<D, B>
The entries of xs whose digest t lacks, each digest once. t grows as entries are taken.
template plan.of source · line 167 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @+dst:Store<D, B> -> @m:Maybe<&2, Store<D, B>> -> Maybe<&2, Store<D, B>>
template plan source · line 175 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @fuel:Nat -> @+src:Store<D, B> -> @+dst:Store<D, B> -> @+root:D -> Maybe<&2, Store<D, B>>
The objects dst needs to load root as src does, or None when src cannot load root.
template live source · line 188 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @+fuel:Nat -> @+s:Store<D, B> -> @roots:List<&2, D> -> Maybe<&2, Store<D, B>>
The closures of every root, or None when one root does not load.
template mem source · line 196 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @ls:Store<D, B> -> @+d:D -> Bool
eq(d, k) for some entry (k, o) of ls.
template keep source · line 211 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @s:Store<D, B> -> @+ls:Store<D, B> -> Store<D, B>
The entries of s whose digest is in ls.
template gc.of source · line 218 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @s:Store<D, B> -> @m:Maybe<&2, Store<D, B>> -> Maybe<&2, Store<D, B>>
template gc source · line 226 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @fuel:Nat -> @+s:Store<D, B> -> @+roots:List<&2, D> -> Maybe<&2, Store<D, B>>
s without the objects that no retained root reaches, or None when a root does not load.
template admit source · line 237 · raw
@-D:Data -> @-B:Data -> @-eq:(@_:D -> @_:D -> Bool) -> @+s:Store<D, B> -> @+claimed:D -> @+computed:D -> @o:Obj<D, B> -> Maybe<&2, Store<D, B>>
Ingress: computed is the digest of o's encoding. None when it is not the claimed digest.
template hash source · line 241 · raw
@-D:Data -> @-B:Data -> @-H:(@_:Obj<D, B> -> D) -> @t:Tree<B> -> D
The Merkle digest of t under the object hash H.
template objects source · line 251 · raw
@-D:Data -> @-B:Data -> @-H:(@_:Obj<D, B> -> D) -> @t:Tree<B> -> Store<D, B>
The objects of t with their digests, children before parents; hash(t) is the last digest.
template valid source · line 275 · raw
@-D:Data -> @-B:Data -> @-H:(@_:Obj<D, B> -> D) -> @-eq:(@_:D -> @_:D -> Bool) -> @s:Store<D, B> -> Bool
True when every entry (k, o) has eq(k, H(o)).
template Index.get source · line 294 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @m:Index(D, B) -> @+d:D -> Maybe<&2, Obj<D, B>>
template Index.has source · line 297 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @m:Index(D, B) -> @+d:D -> Bool
template Index.put.if source · line 300 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @found:Bool -> @m:Index(D, B) -> @+d:D -> @o:Obj<D, B> -> Index(D, B)
template Index.put source · line 308 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @+m:Index(D, B) -> @+d:D -> @o:Obj<D, B> -> Index(D, B)
Adds o under d unless d is present, as Store.put does.
template Index.apply source · line 312 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @xs:Store<D, B> -> @+m:Index(D, B) -> Index(D, B)
Puts each (digest, object) in order.
template Index.of source · line 319 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @xs:Store<D, B> -> Index(D, B)
template Index.load.go source · line 322 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @fuel:Nat -> @+s:Index(D, B) -> @m:Maybe<&2, Obj<D, B>> -> Maybe<&2, Tree<B>>
template Index.load source · line 335 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @fuel:Nat -> @+s:Index(D, B) -> @+d:D -> Maybe<&2, Tree<B>>
template Index.closure.go source · line 338 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @fuel:Nat -> @+s:Index(D, B) -> @+d:D -> @m:Maybe<&2, Obj<D, B>> -> Maybe<&2, Store<D, B>>
template Index.closure source · line 353 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @fuel:Nat -> @+s:Index(D, B) -> @+d:D -> Maybe<&2, Store<D, B>>
template Index.need.head source · line 356 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @+t:Index(D, B) -> @xs:Store<D, B> -> Bool
template Index.need.go source · line 363 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @xs:Store<D, B> -> @+t:Index(D, B) -> @found:Bool -> Store<D, B>
template Index.need source · line 373 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @+xs:Store<D, B> -> @+t:Index(D, B) -> Store<D, B>
template Index.plan.of source · line 376 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @+dst:Index(D, B) -> @m:Maybe<&2, Store<D, B>> -> Maybe<&2, Store<D, B>>
template Index.plan source · line 383 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @fuel:Nat -> @+src:Index(D, B) -> @+dst:Index(D, B) -> @+root:D -> Maybe<&2, Store<D, B>>
template Index.live source · line 386 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @+fuel:Nat -> @+s:Index(D, B) -> @roots:List<&2, D> -> Maybe<&2, Store<D, B>>
template Index.admit source · line 401 · raw
@-D:Data -> @-B:Data -> @-cmp:(@_:D -> @_:D -> Cmp) -> @+s:Index(D, B) -> @+claimed:D -> @+computed:D -> @o:Obj<D, B> -> Maybe<&2, Index(D, B)>
admit on an index: None when claimed is not computed.