@@ -12,7 +12,7 @@ import (
1212 cbg "github.com/whyrusleeping/cbor-gen"
1313)
1414
15- //-----------------------------------------------------------------------------
15+ // -----------------------------------------------------------------------------
1616// Boolean constants
1717type overwrite bool
1818
@@ -58,7 +58,9 @@ type HashFunc func([]byte) []byte
5858
5959// Node is a single point in the HAMT, encoded as an IPLD tuple in DAG-CBOR of
6060// shape:
61- // [bytes, [Pointer...]]
61+ //
62+ // [bytes, [Pointer...]]
63+ //
6264// where 'bytes' is the big.Int#Bytes() and the Pointers array is between 1 and
6365// `2^bitWidth`.
6466//
@@ -74,10 +76,10 @@ type HashFunc func([]byte) []byte
7476//
7577// The IPLD Schema representation of this data structure is as follows:
7678//
77- // type Node struct {
78- // bitfield Bytes
79- // pointers [Pointer]
80- // } representation tuple
79+ // type Node struct {
80+ // bitfield Bytes
81+ // pointers [Pointer]
82+ // } representation tuple
8183type Node struct {
8284 Bitfield * big.Int
8385 Pointers []* Pointer
@@ -91,7 +93,9 @@ type Node struct {
9193
9294// Pointer is an element in a HAMT node's Pointers array, encoded as an IPLD
9395// tuple in DAG-CBOR of shape:
94- // CID or [KV...]
96+ //
97+ // CID or [KV...]
98+ //
9599// i.e. it is represented as a "kinded union" where a Link is a pointer to a
96100// child node, while an array is a bucket of elements local to this node. A
97101// Pointer must represent exactly one of of these two states and cannot be both
@@ -106,12 +110,12 @@ type Node struct {
106110//
107111// The IPLD Schema representation of this data structure is as follows:
108112//
109- // type Pointer union {
110- // &Node link
111- // Bucket list
112- // } representation kinded
113+ // type Pointer union {
114+ // &Node link
115+ // Bucket list
116+ // } representation kinded
113117//
114- // type Bucket [KV]
118+ // type Bucket [KV]
115119type Pointer struct {
116120 KVs []* KV
117121 Link cid.Cid
@@ -152,10 +156,10 @@ type Pointer struct {
152156//
153157// The IPLD Schema representation of this data structure is as follows:
154158//
155- // type KV struct {
156- // key Bytes
157- // value Any
158- // } representation tuple
159+ // type KV struct {
160+ // key Bytes
161+ // value Any
162+ // } representation tuple
159163type KV struct {
160164 Key []byte
161165 Value * cbg.Deferred
@@ -459,8 +463,10 @@ func (n *Node) checkSize(ctx context.Context) (uint64, error) {
459463
460464// Write is a convenience method that calls flush and writes the node to it's
461465// internal store, returning the CID of the stored node. It is equivelant to:
462- // n.Flush
463- // store.Put(ctx, n)
466+ //
467+ // n.Flush
468+ // store.Put(ctx, n)
469+ //
464470// where store is equal to the store provided to the node when constructed.
465471//
466472// write should only be called on the root node of a HAMT
0 commit comments