-
Notifications
You must be signed in to change notification settings - Fork 90
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
Optimize moveos_stdlib::table #908
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
@@ -34,6 +34,9 @@ pub trait StateResolver { | |||
cursor: Option<Vec<u8>>, | |||
limit: usize, | |||
) -> Result<Vec<Option<ListState>>, anyhow::Error>; | |||
|
|||
/// Resolve the table size if the handle is a table. | |||
fn resolve_size(&self, handle: &ObjectID) -> Result<u64, anyhow::Error>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need a resolve_size
in the StateResolver
trait. We can use resolve_state(GLOBAL_OBJECT_STORAGE_HANDLE, table_handle) -> State(TableInfo)
to replace it.
We also can refactor this later. Maybe the StateResolver
need to be refactor to:
pub trait StateResolver {
// get object data from global state tree.
fn resolve_object(&self, object: &ObjectID) -> Result<Option<Object>, anyhow::Error>;
fn resolve_table(&self, handle: &ObjectID, key: &[u8]) -> Result<Option<State>, anyhow::Error>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recorded an issue. Refactoring StateResolver
may relate too many places, I will check that later.
native fun destroy_empty_box_unchecked(table_handle: &ObjectID); | ||
|
||
native fun drop_unchecked_box(table_handle: &ObjectID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge the drop_unchecked_box
and destroy_empty_box_unchecked
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Summary