Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/fix scroll call contract bug #592

Merged
merged 31 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3c03fd0
feat: add doc store
imotai Jun 13, 2023
bf6b69b
Merge remote-tracking branch 'origin/main'
imotai Jun 14, 2023
50dd93a
Merge remote-tracking branch 'origin/main'
imotai Jun 19, 2023
99d8aad
Merge remote-tracking branch 'origin/main'
imotai Jun 21, 2023
ea84758
Merge remote-tracking branch 'origin/main'
imotai Jun 23, 2023
3dc6d3a
Merge remote-tracking branch 'origin/main'
imotai Jun 25, 2023
954d205
Merge remote-tracking branch 'origin/main'
imotai Jun 26, 2023
a70c835
Merge remote-tracking branch 'origin/main'
imotai Jun 29, 2023
4da2934
Merge remote-tracking branch 'origin/main'
imotai Jun 29, 2023
e2938c9
Merge remote-tracking branch 'origin/main'
imotai Jul 2, 2023
afaaa0c
Merge remote-tracking branch 'origin/main'
imotai Jul 3, 2023
3851509
Merge remote-tracking branch 'origin/main'
imotai Jul 4, 2023
20e1d28
Merge remote-tracking branch 'origin/main'
imotai Jul 4, 2023
7d74a39
Merge remote-tracking branch 'origin/main'
imotai Jul 8, 2023
e1d65c8
Merge remote-tracking branch 'origin/main'
imotai Jul 9, 2023
f55f1b8
Merge remote-tracking branch 'origin/main'
imotai Jul 11, 2023
73ac492
Merge remote-tracking branch 'origin/main'
imotai Jul 17, 2023
4ea9ea2
Merge remote-tracking branch 'origin/main'
imotai Jul 20, 2023
6d4dae2
Merge remote-tracking branch 'origin/main'
imotai Jul 20, 2023
a03b34f
Merge remote-tracking branch 'origin/main'
imotai Jul 21, 2023
a991f2c
Merge remote-tracking branch 'origin/main'
imotai Jul 24, 2023
072c1bf
Merge remote-tracking branch 'origin/main'
imotai Jul 28, 2023
1b14371
fix: add test case
imotai Jul 28, 2023
6ecd418
Merge remote-tracking branch 'origin/main' into fix/fix_scroll_call_c…
imotai Jul 28, 2023
51b5bad
fix: add use legacy tx
imotai Jul 28, 2023
b7cf3fc
fix: update the readme
imotai Jul 28, 2023
528aaec
fix: merge from main
imotai Jul 28, 2023
34abedf
fix: fix the metastore case
imotai Jul 28, 2023
e0a43b1
fix: add update the npm version
imotai Jul 28, 2023
4227ed1
fix: fix the release sdk bug
imotai Jul 28, 2023
d494f11
Merge branch 'main' into fix/fix_scroll_call_contract_bug
imotai Jul 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add doc store
  • Loading branch information
imotai committed Jun 13, 2023
commit 3c03fd0cceed66a44996176517d345f88923edf3
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ ethers = {git="https://github.com/imotai/ethers-rs", rev="d526191b7972e8cf4412fe
tonic = {git="https://github.com/hyperium/tonic", rev="ae7580160431cd25c1eecda4c85014ef6ce8d93f"}
tonic-web = {git="https://github.com/hyperium/tonic", rev="ae7580160431cd25c1eecda4c85014ef6ce8d93f"}
arweave-rs = {git="https://github.com/imotai/arweave-rs", rev="7ac5027305db833e4d9b62c967309d5df8fba4f2"}
ejdb2rs = {git="https://github.com/imotai/ejdb2rs", rev="c937a085eda043bd854a0ef4d3e7bb63650610d1"}
serde_json= "1.0"
108 changes: 13 additions & 95 deletions src/proto/proto/db3_database_v2.proto
Original file line number Diff line number Diff line change
Expand Up @@ -54,111 +54,29 @@ message EventTable {
message Collection {
bytes id = 1;
string name = 2;
repeated Index index_list = 3;
repeated Index index_fields = 3;
bytes sender = 4;
}

enum IndexType {
UniqueKey = 0;
StringKey = 1;
Int64Key = 2;
DoubleKey = 3;
}

message Index {
string path = 1;
IndexType index_type = 2;
}

message Document {
bytes id = 1;
bytes doc = 2;
bytes owner = 3;
bytes tx_id = 4;
}

message Index {
// A field in an index.
// The field_path describes which field is indexed, the value_mode describes
// how the field value is indexed.
message IndexField {
// The supported orderings.
enum Order {
// The ordering is unspecified. Not a valid option.
ORDER_UNSPECIFIED = 0;

// The field is ordered by ascending field value.
ASCENDING = 1;

// The field is ordered by descending field value.
DESCENDING = 2;
}

// The supported array value configurations.
enum ArrayConfig {
// The index does not support additional array queries.
ARRAY_CONFIG_UNSPECIFIED = 0;

// The index supports array containment queries.
CONTAINS = 1;
}

// Can be __name__.
// For single field indexes, this must match the name of the field or may
// be omitted.
string field_path = 1;

// How the field value is indexed.
oneof value_mode {
// Indicates that this field supports ordering by the specified order or
// comparing using =, !=, <, <=, >, >=.
Order order = 2;

// Indicates that this field supports operations on `array_value`s.
ArrayConfig array_config = 3;
}
}

// The state of an index. During index creation, an index will be in the
// `CREATING` state. If the index is created successfully, it will transition
// to the `READY` state. If the index creation encounters a problem, the index
// will transition to the `NEEDS_REPAIR` state.
enum State {
// The state is unspecified.
STATE_UNSPECIFIED = 0;

// The index is being created.
// There is an active long-running operation for the index.
// The index is updated when writing a document.
// Some index data may exist.
CREATING = 1;

// The index is ready to be used.
// The index is updated when writing a document.
// The index is fully populated from all stored documents it applies to.
READY = 2;

// The index was being created, but something went wrong.
// There is no active long-running operation for the index,
// and the most recently finished long-running operation failed.
// The index is not updated when writing a document.
// Some index data may exist.
// Use the google.longrunning.Operations API to determine why the operation
// that last attempted to create this index failed, then re-create the
// index.
NEEDS_REPAIR = 3;
}

// Output only. A server defined name for this index.
// The form of this name for composite indexes will be:
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}`
// For single field indexes, this field will be empty.
string name = 1;
// Id of the index filed in the collection
uint32 id = 2;

// The fields supported by this index.
//
// For composite indexes, this is always 2 or more fields.
// The last field entry is always for the field path `__name__`. If, on
// creation, `__name__` was not specified as the last field, it will be added
// automatically with the same direction as that of the last field defined. If
// the final field in a composite index is not directional, the `__name__`
// will be ordered ASCENDING (unless explicitly specified).
//
// For single field indexes, this will always be exactly one entry with a
// field path equal to the field path of the associated field.
repeated IndexField fields = 3;
}

// A Firestore query.
message StructuredQuery {
// A filter.
Expand Down
2 changes: 1 addition & 1 deletion src/proto/proto/db3_mutation_v2.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ message DocumentDatabaseMutation {
}

message CollectionMutation {
repeated db3_database_v2_proto.Index index = 1;
repeated db3_database_v2_proto.Index index_fields = 1;
string collection_name = 2;
}

Expand Down
2 changes: 2 additions & 0 deletions src/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ timer = "0.2.0"
arweave-rs = {workspace=true}
url = "2.4.0"
http = "0.2"
moka = "0.11.2"
ejdb2rs = {workspace=true}
4 changes: 2 additions & 2 deletions src/storage/src/db_store_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl DBStoreV2 {
let col = Collection {
id: id.as_ref().to_vec(),
name: collection.collection_name.to_string(),
index_list: collection.index.to_vec(),
index_fields: collection.index_fields.to_vec(),
sender: sender.as_ref().to_vec(),
};
let mut buf = BytesMut::with_capacity(1024);
Expand Down Expand Up @@ -338,7 +338,7 @@ mod tests {
assert!(false);
}
let collection = CollectionMutation {
index: vec![],
index_fields: vec![],
collection_name: "col1".to_string(),
};
let result =
Expand Down
1 change: 1 addition & 0 deletions src/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub mod db_owner_key;
pub mod db_owner_key_v2;
pub mod db_store;
pub mod db_store_v2;
pub mod doc_store;
pub mod key;
pub mod mutation_store;
pub mod state_store;