Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
izure1 committed Nov 15, 2023
1 parent 65f062b commit c4f0712
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import { BPTree } from 'serializable-bptree'
</script>
```

## conceptualization
## Conceptualization

### Value comparator

Expand Down Expand Up @@ -190,7 +190,7 @@ This kind of delay writing should ideally occur within a few milliseconds. If th

#### readHead(): `SerializeStrategyHead`|`null`

This method is called only once when the tree is created. It's a method to restore the saved tree information. If it's the first tree creation and there are no saved tree information, return `null`.
This method is called only once when the tree is created. It's a method to restore the saved tree information. If it is the initial creation and there is no stored root node, it should return `null`.

This method should return the value stored in the `writeHead` method.

Expand All @@ -200,7 +200,6 @@ This method is called whenever the head information of the tree changes, typical

As a parameter, it receives the header information of the tree. This value should be serialized and stored. Later, the `readHead` method should convert this serialized value into a json format and return it.


### The Default `ValueComparator` and `SerializeStrategy`

To utilize `serializable-bptree`, you need to implement certain functions. However, a few basic helper classes are provided by default.
Expand Down
2 changes: 1 addition & 1 deletion src/SerializeStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export abstract class SerializeStrategy<K, V> {
* It is called when a tree instance is created.
* This method should return the information needed to initialize the tree. This information refers to the values stored in the `writeHead` method.
*
* If it's the first creation and there are no saved root nodes, return `null`.
* If it is the initial creation and there is no stored head, it should return `null`.
* In this case, the tree is created based on the order specified in the strategy instance constructor parameters.
*/
abstract readHead(): SerializeStrategyHead|null
Expand Down
2 changes: 0 additions & 2 deletions test/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ describe('unit-test', () => {
tree.insert('h', 'we')
tree.insert('i', 'use')

console.log(tree.where({ equal: 'cats' }))

expect(tree.where({ equal: 'cats' })).toEqual([
{ key: 'c', value: 'cats' }
])
Expand Down

0 comments on commit c4f0712

Please sign in to comment.