Change Id format #226
Replies: 5 comments 2 replies
-
If we do Multi-Raft #131 we should add raft-group-id to the log like
This should be also considered. |
Beta Was this translation helpful? Give feedback.
-
idea:
|
Beta Was this translation helpful? Give feedback.
-
Just to avoid deep copy, some library is making such effort. https://sixtyfps.io/releases/0.1.1/docs/rust/sixtyfps/struct.sharedstring |
Beta Was this translation helpful? Give feedback.
-
In 0.8, I will use pub struct Id(Arc<tonic::transport::Uri>); Id should be both |
Beta Was this translation helpful? Give feedback.
-
Cloning #[derive(Clone)]
pub struct Uri {
scheme: Scheme,
authority: Authority,
path_and_query: PathAndQuery,
} Because #[derive(Copy, Clone, Debug)]
pub(super) enum Protocol {
Http,
Https,
}
impl Scheme {
/// HTTP protocol scheme
pub const HTTP: Scheme = Scheme {
inner: Scheme2::Standard(Protocol::Http),
};
/// HTTP protocol over TLS.
pub const HTTPS: Scheme = Scheme {
inner: Scheme2::Standard(Protocol::Https),
}; And /// Represents the authority component of a URI.
#[derive(Clone)]
pub struct Authority {
pub(super) data: ByteStr,
} which is backed by pub(crate) struct ByteStr {
// Invariant: bytes contains valid UTF-8
bytes: Bytes,
}
#[derive(Clone)]
pub struct PathAndQuery {
pub(super) data: ByteStr,
pub(super) query: u16,
} Using ByteStr in part must be a developer's intention to make cloning cheap. So we shouldn't wrap it in |
Beta Was this translation helpful? Give feedback.
-
Raft node can be identified by its address because it is unique. This is why lol defines
Id = Address
.My idea is change this to
Id = (Label, Address)
. This change will make it easy toAlso, as the label is shorter than Address it is much efficient to compare two labels instead of addresses. This will be a bit of optimization.
Beta Was this translation helpful? Give feedback.
All reactions