Skip to content

Commit 047e2b7

Browse files
authored
Merge pull request #53 from srdtrk/master
Revamp of the storage sub-package
2 parents 98f72b4 + 3725530 commit 047e2b7

File tree

11 files changed

+2599
-2259
lines changed

11 files changed

+2599
-2259
lines changed

packages/incubator/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ cosmwasm-storage = { package = "secret-cosmwasm-storage", version = "0.10", opti
2020
secret-toolkit-serialization = { version = "0.3", path = "../serialization", optional = true }
2121

2222
[features]
23-
cashmap = ["cosmwasm-storage", "serde", "secret-toolkit-serialization", "cosmwasm-std"]
2423
generational-store = ["secret-toolkit-serialization", "serde", "cosmwasm-std"]
2524
maxheap = ["secret-toolkit-serialization", "serde", "cosmwasm-std"]

packages/incubator/Readme.md

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,6 @@
44

55
This package contains tools that are not yet final and may change or contain unknown bugs, and are pending more testing or reviews.
66

7-
## Cashmap
8-
9-
A hashmap-like structure, that allows iteration with paging over keys without guaranteed ordering.
10-
An example use-case for such a structure is if you want to contain a large amount of votes, deposits, or bets and iterate over them at some time in the future.
11-
Since iterating over large amounts of data at once may be prohibitive, this structure allows you to specify the amount of data that will
12-
be returned in each page.
13-
14-
This structure may also be used as a hashmap structure without the fancy bells and whistles, though gas-costs will be more expensive than simple storage.
15-
16-
### Usage
17-
18-
#### Initialization
19-
20-
You can open/initialize the cashmap directly using
21-
22-
```rust
23-
let mut storage = MockStorage::new();
24-
let mut cmap = CashMap::init(b"cashmap-name", &mut storage);
25-
```
26-
27-
#### Access pattern
28-
29-
Todo: improve this section
30-
31-
```rust
32-
let foo1 = Foo {
33-
string: "string one".to_string(),
34-
number: 1111,
35-
};
36-
37-
cmap.insert(b"key1", foo1.clone())?;
38-
let read_foo1 = cmap.get(b"key1").unwrap();
39-
cmap.remove(b"key1")?;
40-
```
41-
42-
### Todo
43-
44-
Generalize keys to allow any hashable type, not just &[u8]
45-
467
## Max heap storage
478

489
A "max heap store" is a storage wrapper that implements a binary tree maxheap data structure.

0 commit comments

Comments
 (0)