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

how to distinguish rpc called from which peer #633

Open
ahczbhht1989 opened this issue Aug 20, 2021 · 2 comments
Open

how to distinguish rpc called from which peer #633

ahczbhht1989 opened this issue Aug 20, 2021 · 2 comments

Comments

@ahczbhht1989
Copy link

pub trait FileSystem {
    type Metadata;
    fn new() -> Self;
    #[rpc(name = "open_file")]
    fn open_file(&self, file_name: String) -> Result<OpenFileResult>;
}

I have the rpc method open_file,I want to know which peer called open_file,and do somthing. How to do it.

@tomusdrw
Copy link
Contributor

You can use Metadata to get information about the client. It would be necessary to implement MetaExtractor and use some of the data available in RequestContext.

@ahczbhht1989
Copy link
Author

Thank you.Can you give me a example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants