-
Notifications
You must be signed in to change notification settings - Fork 0
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
Applying Rust changes to add tags #3
base: vic-changes2
Are you sure you want to change the base?
Conversation
@@ -6,7 +6,7 @@ use db::RocksDB; | |||
use ed25519_dalek::{Signature, Signer, SigningKey, VerifyingKey, EXPANDED_SECRET_KEY_LENGTH}; |
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.
This file exposes mappings of Rust addon-functions to external JS code.
@@ -73,6 +73,9 @@ pub enum RootPrefix { | |||
|
|||
/* Used to index fname username proofs by fid */ | |||
FNameUserNameProofByFid = 27, | |||
|
|||
/* Used to index tags by target */ |
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.
These pre and post-fixes are used to generate keys in the RocksDB key-value pairs
@@ -8,6 +8,7 @@ pub use self::user_data_store::*; | |||
pub use self::username_proof_store::*; | |||
pub use self::utils::*; | |||
pub use self::verification_store::*; | |||
pub use self::tag_store::*; |
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.
mod.rs is the module definition for the Store
module, basically, like an index.js
@@ -472,6 +472,57 @@ export const rsGetReactionsByTarget = async ( | |||
return await lib.getReactionsByTarget.call(store, targetCastIdBytes, targetUrl, type, pageOptions); | |||
}; | |||
|
|||
/** Tags **/ |
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.
Wrapper around the Rust DB functions, used by JS functions in Hubble.
@@ -101,6 +101,10 @@ export enum UserPostfix { | |||
UsernameProofMessage = 7, | |||
|
|||
// Add new message types here | |||
|
|||
/* Tag */ |
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.
Note that this needs to be exactly duplicated in the message.rs
file in the Rust addon
@@ -78,6 +78,9 @@ export enum RootPrefix { | |||
|
|||
/* Used to index fname username proofs by fid */ | |||
FNameUserNameProofByFid = 27, | |||
|
|||
/* Used to index reactions by target */ | |||
TagsByTarget = 28, |
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.
Note that this needs to be exactly duplicated in the message.rs
file in the Rust addon
@@ -113,6 +113,10 @@ export const typeToSetPostfix = (type: MessageType): UserMessagePostfix => { | |||
return UserPostfix.LinkCompactStateMessage; | |||
} | |||
|
|||
if (type === MessageType.TAG_ADD || type === MessageType.TAG_REMOVE) { |
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.
typeToSetPostfix
is a utility map for deriving postfix from type in JS
Rust TODOs
u8
key portion of the tags that was due to reaction types to a hash (reuseblake3_20
inutils.js
)TS Missing Implementations
apps/hubble/src/rpc/httpServer.ts
)apps/hubble/src/rpc/server.ts
)TS Missing Tests
apps/hubble/src/rpc/test/reactionService.test.ts
)