Comments (3)
I think setting bytes
to prost_build::Config
will use Bytes
as proto bytes.
I am ready. #134
from lolraft.
Here is a code-base explanation.
As of 0.6.3 (with prost 0.6), AppendStreamEntry
has Vec<u8>
payload
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AppendStreamEntry {
#[prost(uint64, tag = "1")]
pub term: u64,
#[prost(uint64, tag = "2")]
pub index: u64,
#[prost(bytes = "vec", tag = "3")]
pub command: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AppendEntryReq {
#[prost(oneof = "append_entry_req::Elem", tags = "1, 2")]
pub elem: ::core::option::Option<append_entry_req::Elem>,
}
and
struct LogStreamElem {
term: Term,
index: Index,
command: Bytes,
}
fn into_out_stream(
x: LogStream
) -> impl futures::stream::Stream<Item = crate::proto_compiled::AppendEntryReq> {
use crate::proto_compiled::{append_entry_req::Elem, AppendStreamHeader, AppendStreamEntry};
let header_stream = vec![Elem::Header(AppendStreamHeader {
sender_id: x.sender_id,
prev_log_index: x.prev_log_index,
prev_log_term: x.prev_log_term,
})];
let header_stream = futures::stream::iter(header_stream);
let chunk_stream = x.entries.map(|e| {
Elem::Entry(AppendStreamEntry {
term: e.term,
index: e.index,
command: e.command.as_ref().into(), // HERE
})
});
header_stream.chain(chunk_stream).map(|e| crate::proto_compiled::AppendEntryReq {
elem: Some(e)
})
}
LogStream
which is the corresponding internal structure with Bytes
payload is copied into the Vec<u8>
payload.
If the external (inter-nodes) stream uses Bytes
as the payload type, we will eliminate copies.
from lolraft.
done.
from lolraft.
Related Issues (20)
- Multi-raft
- Add versioning to membership
- Rework: RaftCore is too monolithic HOT 1
- Support duplicated requests HOT 3
- Load balancer and stable connection HOT 2
- Avoid duplicated response HOT 2
- Multi-Raft: config dissemination HOT 2
- The project name has too low googlability.
- Use cargo-chef in testapp Docker
- Run test in GHA with docker compose
- Bump http-serde to 2.0
- Release v0.10 HOT 1
- Implement reflection HOT 1
- Write doc
- Multiplexed heartbeat HOT 3
- Extend testapp for testing multi-raft
- CI: Cache test artifact
- multi_raft_test with L50 fails
- test: Initialize lanes in parallel
- Include lane_id in the log
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lolraft.