From eed07caeab9c210a9875e5c8d3b99abc43e574ab Mon Sep 17 00:00:00 2001
From: tabcat <tabcat00@proton.me>
Date: Thu, 24 Oct 2024 16:55:57 +0700
Subject: [PATCH] docs(interface): improve comments

---
 src/interface.ts | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/interface.ts b/src/interface.ts
index 8b69ca7..d62927c 100644
--- a/src/interface.ts
+++ b/src/interface.ts
@@ -10,9 +10,22 @@ 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 {
@@ -20,7 +33,11 @@ export interface Bucket extends Prefix {
   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;
 }