Skip to content

Commit

Permalink
Use encode_varint for vector size
Browse files Browse the repository at this point in the history
  • Loading branch information
simlay committed Feb 9, 2021
1 parent a533495 commit 66d7e4e
Show file tree
Hide file tree
Showing 22 changed files with 96 additions and 84 deletions.
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.0-alpha.4
0.7.0-alpha.5
6 changes: 3 additions & 3 deletions src/auth/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-auth"
version = "0.3.0"
version = "0.4.0"
authors = ["Fluvio Contributors <team@fluvio.io>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -14,8 +14,8 @@ path = "src/lib.rs"

[dependencies]
async-trait = "0.1.41"
fluvio-controlplane-metadata = { version = "0.5.0", path = "../controlplane-metadata" }
dataplane = { version = "0.2.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }
fluvio-controlplane-metadata = { version = "0.6.0", path = "../controlplane-metadata" }
dataplane = { version = "0.3.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }
fluvio-future = { version = "0.1.12", features = ["net", "openssl_tls"] }
fluvio-protocol = { path = "../protocol", version = "0.3.0" }
fluvio-socket = { path = "../socket", version = "0.5.0" }
Expand Down
8 changes: 4 additions & 4 deletions src/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-cli"
version = "0.4.1"
version = "0.5.0"
edition = "2018"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "Fluvio CLI"
Expand Down Expand Up @@ -48,12 +48,12 @@ sysinfo = "0.16.1"
k8-config = { version = "1.3.0" }
k8-client = { version = "5.0.0" }
fluvio-future = { version = "0.1.8", features = ["fs", "io", "subscriber"] }
fluvio = { version = "0.4.1", path = "../client", default-features = false }
fluvio = { version = "0.5.0", path = "../client", default-features = false }
fluvio-cluster = { version = "0.7.0", path = "../cluster", default-features = false, features = ["cli"] }
fluvio-package-index = { version = "0.2.0", path = "../package-index" }
fluvio-extension-consumer = { version = "0.2.0", path = "../extension-consumer" }
fluvio-extension-common = { version = "0.1.0", path = "../extension-common", features = ["target"]}
fluvio-controlplane-metadata = { version = "0.5.0", path = "../controlplane-metadata", features = ["use_serde", "k8"] }
fluvio-extension-common = { version = "0.2.0", path = "../extension-common", features = ["target"]}
fluvio-controlplane-metadata = { version = "0.6.0", path = "../controlplane-metadata", features = ["use_serde", "k8"] }
k8-types = { version = "0.1.0", features = ["core"]}

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions src/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio"
version = "0.4.1"
version = "0.5.0"
edition = "2018"
license = "Apache-2.0"
authors = ["Fluvio Contributors <team@fluvio.io>"]
Expand Down Expand Up @@ -38,11 +38,11 @@ semver = "0.11.0"
# Fluvio dependencies
fluvio-future = { version = "0.1.15", features = ["task", "native2_tls"] }
fluvio-types = { version = "0.2.0", path = "../types" }
fluvio-sc-schema = { version = "0.5.0", path = "../sc-schema", default-features = false }
fluvio-spu-schema = { version = "0.3.0", path = "../spu-schema" }
fluvio-sc-schema = { version = "0.6.0", path = "../sc-schema", default-features = false }
fluvio-spu-schema = { version = "0.4.0", path = "../spu-schema" }
fluvio-socket = { path = "../socket", version = "0.5.0", features = ["tls"] }
fluvio-protocol = { path = "../protocol", version = "0.3.0" }
dataplane = { version = "0.2.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }
dataplane = { version = "0.3.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }

[dev-dependencies]
async-std = "1.6.4"
2 changes: 1 addition & 1 deletion src/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub use crate::admin::FluvioAdmin;
pub use crate::client::Fluvio;

/// The minimum VERSION of the Fluvio Platform that this client is compatible with.
const MINIMUM_PLATFORM_VERSION: &str = "0.7.0-alpha.1";
const MINIMUM_PLATFORM_VERSION: &str = "0.7.0-alpha.5";

/// Creates a producer that sends events to the named topic
///
Expand Down
8 changes: 4 additions & 4 deletions src/cluster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ proclist = "0.9.2"
remoteprocess = "0.4.2"

# Fluvio dependencies
fluvio = { version = "0.4.1", path = "../client", default-features = false }
fluvio = { version = "0.5.0", path = "../client", default-features = false }
fluvio-helm = "0.4.1"
fluvio-future = { version = "0.1.13" }
fluvio-command = { version = "0.2.0", path = "../command" }
fluvio-runner-local = { version = "0.2.0", path = "../extension-runner-local", optional = true }
fluvio-extension-common = { version = "0.1.0", path = "../extension-common", optional = true }
fluvio-controlplane-metadata = { version = "0.5.0", path = "../controlplane-metadata", features = ["k8"] }
fluvio-runner-local = { version = "0.3.0", path = "../extension-runner-local", optional = true }
fluvio-extension-common = { version = "0.2.0", path = "../extension-common", optional = true }
fluvio-controlplane-metadata = { version = "0.6.0", path = "../controlplane-metadata", features = ["k8"] }
flv-util = "0.5.2"
k8-config = { version = "1.3.0" }
k8-client = { version = "5.0.0" }
Expand Down
4 changes: 2 additions & 2 deletions src/controlplane-metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "fluvio-controlplane-metadata"
edition = "2018"
version = "0.5.0"
version = "0.6.0"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "Fluvio metadata"
repository = "https://github.com/infinyon/fluvio"
Expand All @@ -27,7 +27,7 @@ flv-util = { version = "0.5.0" }
fluvio-types = { version = "0.2.0", path = "../types" }
fluvio-stream-model = { path = "../stream-model", version = "0.4.0" }
fluvio-protocol = { path = "../protocol", version = "0.3.0" }
dataplane = { version = "0.2.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }
dataplane = { version = "0.3.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }


[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions src/controlplane/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-controlplane"
version = "0.5.0"
version = "0.6.0"
edition = "2018"
license = "Apache-2.0"
description = "Fluvio control plane API"
Expand All @@ -17,6 +17,6 @@ tracing = "0.1.19"

# Fluvio dependencies
fluvio-types = { path = "../types", version = "0.2.0" }
fluvio-controlplane-metadata = { path = "../controlplane-metadata", version = "0.5.0" }
fluvio-controlplane-metadata = { path = "../controlplane-metadata", version = "0.6.0" }
fluvio-protocol = { path = "../protocol", version = "0.3.0" }
dataplane = { version = "0.2.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }
dataplane = { version = "0.3.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }
2 changes: 1 addition & 1 deletion src/dataplane-protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-dataplane-protocol"
version = "0.2.0"
version = "0.3.0"
edition = "2018"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "data plane protocol"
Expand Down
2 changes: 1 addition & 1 deletion src/dataplane-protocol/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ mod test {

let decoded_record = batch.records.get(0).unwrap();
println!("record crc: {}", batch.header.crc);
assert_eq!(batch.header.crc, 2908671645);
assert_eq!(batch.header.crc, 843514105);
let b = decoded_record.value.as_ref();
assert_eq!(b, b"test");

Expand Down
30 changes: 21 additions & 9 deletions src/dataplane-protocol/src/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use log::{trace, warn};
use once_cell::sync::Lazy;

use crate::core::bytes::Buf;
use crate::core::bytes::BufExt;
use crate::core::bytes::BufMut;
use bytes::buf::BufExt;

use crate::core::Decoder;
use crate::core::DecoderVarInt;
Expand Down Expand Up @@ -138,14 +138,22 @@ impl<'a> From<&'a [u8]> for DefaultAsyncBuffer {

impl Encoder for DefaultAsyncBuffer {
fn write_size(&self, version: Version) -> usize {
self.0.write_size(version)
let len = self.0.len() as i64;
self.0.iter().fold(len.var_write_size(), |sum, val| {
sum + val.write_size(version)
})
}

fn encode<T>(&self, src: &mut T, version: Version) -> Result<(), Error>
fn encode<T>(&self, dest: &mut T, version: Version) -> Result<(), Error>
where
T: BufMut,
{
self.0.encode(src, version)
let len: i64 = self.0.len() as i64;
len.encode_varint(dest)?;
for v in self.0.iter() {
v.encode(dest, version)?;
}
Ok(())
}
}

Expand All @@ -156,7 +164,14 @@ impl Decoder for DefaultAsyncBuffer {
{
trace!("decoding default asyncbuffer");
if let Some(ref mut buffer) = Arc::get_mut(&mut self.0) {
buffer.decode(src, version)
let mut len: i64 = 0;
len.decode_varint(src)?;
for _ in 0..len {
let mut value = <u8>::default();
value.decode(src, version)?;
buffer.push(value);
}
Ok(())
} else {
Err(Error::new(
ErrorKind::Other,
Expand Down Expand Up @@ -434,10 +449,7 @@ mod test {
record.encode(&mut out, 0)?;
println!("ENCODED: {:#x?}", out);
*/

let data = [
0x1e, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x64, 0x6f, 0x67, 0x0,
];
let data = [0x12, 0x0, 0x0, 0x2, 0x0, 0x6, 0x64, 0x6f, 0x67, 0x0];

let record = DefaultRecord::decode_from(&mut Cursor::new(&data), 0)?;
assert_eq!(record.as_bytes(0)?.len(), data.len());
Expand Down
4 changes: 2 additions & 2 deletions src/extension-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-extension-common"
version = "0.1.0"
version = "0.2.0"
edition = "2018"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "Fluvio extension common"
Expand Down Expand Up @@ -28,4 +28,4 @@ futures-lite = { version = "1.7.0" }
thiserror = "1.0.20"


fluvio = { version = "0.4.0", path = "../client", optional = true }
fluvio = { version = "0.5.0", path = "../client", optional = true }
8 changes: 4 additions & 4 deletions src/extension-consumer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ hostname-validator = "1.0.0"

flv-util = { version = "0.5.0" }
fluvio-future = { version = "0.1.8", features = ["fs", "io"] }
fluvio = { version = "0.4.1", path = "../client", default-features = false }
fluvio = { version = "0.5.0", path = "../client", default-features = false }
fluvio-types = { version = "0.2.0" , path = "../types" }
fluvio-extension-common = { version = "0.1.0", path = "../extension-common", features = ["target"] }
fluvio-controlplane-metadata = { version = "0.5.0", path = "../controlplane-metadata", features = ["use_serde"] }
fluvio-sc-schema = { version = "0.5.0", path = "../sc-schema", features = ["use_serde"] }
fluvio-extension-common = { version = "0.2.0", path = "../extension-common", features = ["target"] }
fluvio-controlplane-metadata = { version = "0.6.0", path = "../controlplane-metadata", features = ["use_serde"] }
fluvio-sc-schema = { version = "0.6.0", path = "../sc-schema", features = ["use_serde"] }
6 changes: 3 additions & 3 deletions src/extension-runner-local/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-runner-local"
version = "0.2.0"
version = "0.3.0"
edition = "2018"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "Fluvio Engine Runner"
Expand All @@ -22,5 +22,5 @@ thiserror = "1.0.20"

# regardless of TLS, sc and spu always use openssl_tls for now because we need cert API
fluvio-future = { version = "0.1.12", features = ["subscriber"] }
fluvio-sc = { version = "0.4.0", path = "../sc" }
fluvio-spu = { version = "0.3.0", path = "../spu" }
fluvio-sc = { version = "0.5.0", path = "../sc" }
fluvio-spu = { version = "0.4.0", path = "../spu" }
6 changes: 3 additions & 3 deletions src/sc-schema/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-sc-schema"
version = "0.5.0"
version = "0.6.0"
edition = "2018"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "Fluvio API for SC"
Expand All @@ -23,6 +23,6 @@ static_assertions = "1.1.0"

# Fluvio dependencies
fluvio-types = { version = "0.2.0", path = "../types" }
fluvio-controlplane-metadata = { version = "0.5.0", default-features = false, path = "../controlplane-metadata" }
fluvio-controlplane-metadata = { version = "0.6.0", default-features = false, path = "../controlplane-metadata" }
fluvio-protocol = { path = "../protocol", version = "0.3.0" }
dataplane = { version = "0.2.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }
dataplane = { version = "0.3.0", path = "../dataplane-protocol", package = "fluvio-dataplane-protocol" }
Loading

0 comments on commit 66d7e4e

Please sign in to comment.