Skip to content

Commit

Permalink
docs(interface): improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tabcat committed Oct 24, 2024
1 parent 200d2eb commit eed07ca
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,34 @@ export interface Entry extends Tuple {
}

export interface Prefix {
readonly average: number; // same for all buckets of the same tree
readonly level: number; // changes based on level of the bucket in the tree, leaves are always level 0
readonly base: number; // base number for delta encoding of entry seq field
/**
* Must be the same for all buckets of the same tree.
*/
readonly average: number;

/**
* Changes based on the level of the bucket in the tree.
* Leaves are always level 0.
*/
readonly level: number;

/**
* Base number for delta encoding.
* Set to boundary seq, 0 if the bucket is empty.
*/
readonly base: number;
}

export interface Bucket extends Prefix {
readonly entries: Entry[];
getBytes(): Uint8Array;
getCID(): CID;
getDigest(): Uint8Array;
getBoundary(): Entry | null; // null if bucket is empty

/**
* Null if the bucket is empty.
*/
getBoundary(): Entry | null;
getParentEntry(): Entry | null;
}

Expand Down

0 comments on commit eed07ca

Please sign in to comment.