-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add non-streaming methods #112
Comments
See also #47, which can be a first version (not sure if it can include the solana validator version?). |
linuskendall: |
share read/write design for MessageBlockMeta // plugin.rs
#[derive(Debug)]
pub struct PluginInner {
// ...
latest_block_meta: Arc<RwLock<Option<MessageBlockMeta>>>,
}
// grpc.rs
#[derive(Clone)]
pub struct GrpcService {
// ...
latest_block_meta: Arc<RwLock<Option<MessageBlockMeta>>>,
}
// plugin.rs
fn notify_block_metadata(
&mut self,
blockinfo: ReplicaBlockInfoVersions<'_>,
) -> PluginResult<()> {
// ...
if let Ok(mut latest_block_meta_write_guard) = inner.latest_block_meta.write() {
*latest_block_meta_write_guard = Some(block_meta.clone());
}
}
// grpc.rs
async fn get_latest_blockhash(&self, _request: Request<GetLatestBlockhashRequest>) -> Result<Response<GetLatestBlockhashResponse>, Status> {
if let Ok(message_block_meta) = self.latest_block_meta.read() {
let v= message_block_meta.as_ref();
if let Some(v) = v {
let response = GetLatestBlockhashResponse {
slot: v.slot,
blockhash: v.blockhash.clone(),
block_height: v.block_height.unwrap(),
};
return Ok(Response::new(response));
}
}
Err(Status::internal("latest_block_meta is None"))
} |
…ash (#117) * feat: unary Ping method for geyser_server * fix: variables can be used directly in the `format!` string * feat: Geyser server getLatestBlockhash method * fix: use RwLock from tokio by fanatid: I think it's better to use RwLock from tokio, everything what we have is async * feat: #112 getBlockHeight & getSlot * use RwLock and mpsc (#118) --------- Co-authored-by: Kirill Fomichev <[email protected]>
one more question for isBlockhashValid/is_blockhash_valid: in Solana validator, we could hold a Arc We could use the following method:
The potential issue here is: only newly added blockhashes are recorded at startup, and historical blockhashes are not recorded. it may be necessary to maintain a separate historical database for querying. |
I would like to add non streaming methods that could help users who are writing trading code:
Harder ones that we could potentially do if we add much more logic to the code
Ones that I don't know if possible (what info would we require to do this? maybe some modification to geyser interface to send some of this info on start up):
Others..?
The text was updated successfully, but these errors were encountered: