fdb-rs / fdb Goto Github PK
View Code? Open in Web Editor NEWFoundationDB client API for Tokio
Home Page: https://fdb-rs.github.io/
License: Apache License 2.0
FoundationDB client API for Tokio
Home Page: https://fdb-rs.github.io/
License: Apache License 2.0
Any plans to support the directory layer?
I took the get_range example, changed the fdb_cluster_file to an empty string, and the open fails with a 1515 error "No cluster file found in current directory or default location".
Hey,
first, thanks for making this available!
I'm having some issues getting started, my code looks like this:
#[tokio::main]
async fn main() -> anyhow::Result<()> {
pretty_env_logger::init();
let c_path = std::path::Path::new("/etc/foundationdb/fdb.cluster");
let db = fdb::open_database(c_path)?;
Ok(())
}
But if I try to run it, I get this error:
Error: FdbError { error_code: 2008 }
Can't figure out what I'm doing wrong, so any help appreciated.
Cargo.toml
[package]
name = "fdb-test"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.57"
fdb = { version = "0.3.1", features = ["fdb-7_1"] }
pretty_env_logger = "0.4.0"
tokio = { version = "1.18.2", features = ["full"] }
status
fdbcli --exec status
Using cluster file `/etc/foundationdb/fdb.cluster'.
Configuration:
Redundancy mode - single
Storage engine - memory-2
Coordinators - 1
Usable Regions - 1
Cluster:
FoundationDB processes - 1
Zones - 1
Machines - 1
Memory availability - 8.0 GB per process on machine with least available
Fault Tolerance - 0 machines
Server time - 05/10/22 18:48:22
Data:
Replication health - Healthy
Moving data - 0.000 GB
Sum of key-value sizes - 0 MB
Disk space used - 105 MB
Operating space:
Storage server - 1.0 GB free on most full server
Log server - 547.0 GB free on most full server
Workload:
Read rate - 17 Hz
Write rate - 0 Hz
Transactions started - 5 Hz
Transactions committed - 0 Hz
Conflict rate - 0 Hz
Backup and DR:
Running backups - 0
Running DRs - 0
Client time: 05/10/22 18:48:22
version
fdbserver -v
FoundationDB 7.1 (v7.1.4)
source version cb750b1859ab68993ee2c2991c9e85fc125eca2b
protocol fdb00b071010000
Looks like rust made a change in 1.70 to throw on misaligned pointer dereferences. I'm seeing some errors:
stack backtrace:
0: rust_begin_unwind
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
1: core::panicking::panic_fmt
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
2: core::panicking::panic_misaligned_pointer_dereference
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:174:5
3: <fdb::range::KeyValueArray as fdb::future::FdbFutureGet>::get::{{closure}}::{{closure}}
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fdb-0.3.1/src/future.rs:413:21
4: core::iter::traits::iterator::Iterator::for_each::call::{{closure}}
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:854:29
5: core::iter::traits::iterator::Iterator::fold
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:2482:21
6: core::iter::traits::iterator::Iterator::for_each
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:857:9
7: <fdb::range::KeyValueArray as fdb::future::FdbFutureGet>::get::{{closure}}
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fdb-0.3.1/src/future.rs:409:13
8: core::result::Result<T,E>::map
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:759:25
9: <fdb::range::KeyValueArray as fdb::future::FdbFutureGet>::get
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fdb-0.3.1/src/future.rs:400:9
10: <fdb::future::FdbFuture<T> as core::future::future::Future>::poll
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fdb-0.3.1/src/future.rs:172:34
11: fdb::range::RangeResultStateMachine::poll_next
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fdb-0.3.1/src/range.rs:358:31
12: <fdb::future::FdbStreamKeyValue as futures_core::stream::Stream>::poll_next
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fdb-0.3.1/src/future.rs:588:9
13: futures_util::stream::stream::StreamExt::poll_next_unpin
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.28/src/stream/stream/mod.rs:1632:9
14: <futures_util::stream::stream::next::Next<St> as core::future::future::Future>::poll
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.28/src/stream/stream/next.rs:32:9
15: <fdblib::directory::FDBDriver as fdblib::directory::Database>::get_project_keys::{{closure}}::{{closure}}::{{closure}}
at ./src/directory.rs:1259:46
16: fdb::database::fdb_database::FdbDatabase::read::{{closure}}
at /Users/ggilley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fdb-0.3.1/src/database/fdb_database.rs:258:39
In the current implementation, methods on a value of KeyValue type, returns a ref type (&Key
or &Value
).
However, in most cases, this is followed by a clone, in-order to get a owned value of either Key
or Value
type. Therefore, the API can be simplified to
fn into_key(self) -> Key
fn into_value(self) -> Value
fn into_parts(self) -> (Key, Value)
This is a breaking change, so schedule it for 0.3 release.
I'm trying to read a block of tuples in and group them by a prefix. I need to be able to, for example, drop the first element of the tuple, then pass it on. It looks like you tried to prevent that unlike the other fdb apis? (e.g. java and golang).
I'm doing something like what is described here: https://forums.foundationdb.org/t/best-practice-of-storing-structs-should-i-pack-or-store-fields-separately/425/2?u=dongxineric
I'm storing the fields separately which means I need to be able to gather them by the "key" prefix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.