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

Encode database label file names using URL encoding (optionally) #130

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ base64 = "0.13"
hex = "0.4"
regex = "1.5"
lru = "0.10"
urlencoding = "2.1.2"
dyn-clone = "1.0.11"

[dev-dependencies]
tempfile = "3.1"
Expand Down
3 changes: 2 additions & 1 deletion benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ extern crate test;
use tempfile::tempdir;
use terminus_store;
use terminus_store::layer::ValueTriple;
use terminus_store::storage::directory::NoFilenameEncoding;
use test::Bencher;

#[bench]
fn bench_add_string_triple(b: &mut Bencher) {
let dir = tempdir().unwrap();
let sync_store = terminus_store::open_sync_directory_store(dir.path());
let sync_store = terminus_store::open_sync_directory_store(dir.path(), NoFilenameEncoding);
let layer_builder = sync_store.create_base_layer().unwrap();
let mut count = 1;
b.iter(|| {
Expand Down
11 changes: 6 additions & 5 deletions benches/builder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ mod data;
use rand::prelude::*;
use tempfile::tempdir;
use terminus_store;
use terminus_store::storage::directory::NoFilenameEncoding;
use test::Bencher;

use data::*;

#[bench]
fn build_empty_base_layer(b: &mut Bencher) {
let dir = tempdir().unwrap();
let store = terminus_store::open_sync_directory_store(dir.path());
let store = terminus_store::open_sync_directory_store(dir.path(), NoFilenameEncoding);

b.iter(|| {
let builder = store.create_base_layer().unwrap();
Expand All @@ -23,7 +24,7 @@ fn build_empty_base_layer(b: &mut Bencher) {
#[bench]
fn build_base_layer_1000(b: &mut Bencher) {
let dir = tempdir().unwrap();
let store = terminus_store::open_sync_directory_store(dir.path());
let store = terminus_store::open_sync_directory_store(dir.path(), NoFilenameEncoding);

let seed = b"the quick brown fox jumped over ";
let rand = StdRng::from_seed(*seed);
Expand All @@ -48,7 +49,7 @@ fn build_base_layer_1000(b: &mut Bencher) {
#[bench]
fn build_empty_child_layer_on_empty_base_layer(b: &mut Bencher) {
let dir = tempdir().unwrap();
let store = terminus_store::open_sync_directory_store(dir.path());
let store = terminus_store::open_sync_directory_store(dir.path(), NoFilenameEncoding);
let builder = store.create_base_layer().unwrap();
let base_layer = builder.commit().unwrap();

Expand All @@ -61,7 +62,7 @@ fn build_empty_child_layer_on_empty_base_layer(b: &mut Bencher) {
#[bench]
fn build_nonempty_child_layer_on_empty_base_layer(b: &mut Bencher) {
let dir = tempdir().unwrap();
let store = terminus_store::open_sync_directory_store(dir.path());
let store = terminus_store::open_sync_directory_store(dir.path(), NoFilenameEncoding);
let builder = store.create_base_layer().unwrap();
let base_layer = builder.commit().unwrap();

Expand All @@ -88,7 +89,7 @@ fn build_nonempty_child_layer_on_empty_base_layer(b: &mut Bencher) {
#[bench]
fn build_nonempty_child_layer_on_nonempty_base_layer(b: &mut Bencher) {
let dir = tempdir().unwrap();
let store = terminus_store::open_sync_directory_store(dir.path());
let store = terminus_store::open_sync_directory_store(dir.path(), NoFilenameEncoding);

let seed = b"the quick brown fox jumped over ";
let rand = StdRng::from_seed(*seed);
Expand Down
3 changes: 2 additions & 1 deletion examples/create_graph.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::env;

use terminus_store::storage::directory::NoFilenameEncoding;
use terminus_store::*;
use tokio;

Expand All @@ -10,7 +11,7 @@ async fn main() {
println!("usage: {} <path> <graph_name>", args[0]);
} else {
// open a store at the given path. the directory has to exist.
let store = open_directory_store(&args[1]);
let store = open_directory_store(&args[1], NoFilenameEncoding);

// then create a graph. if the graph already exists, this will error.
store.create(&args[2]).await.unwrap();
Expand Down
3 changes: 2 additions & 1 deletion examples/print_graph.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use std::env;

use std::io;
use terminus_store::storage::directory::NoFilenameEncoding;
use terminus_store::structure::TdbDataType;
use terminus_store::*;
use tokio;

async fn print_graph(store_path: &str, graph: &str) -> io::Result<()> {
let store = open_directory_store(store_path);
let store = open_directory_store(store_path, NoFilenameEncoding);
let graph = store
.open(graph)
.await?
Expand Down
3 changes: 2 additions & 1 deletion examples/write_to_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::env;

use lazy_static::lazy_static;
use regex::Regex;
use terminus_store::storage::directory::NoFilenameEncoding;
use terminus_store::*;
use tokio;
use tokio::io::{self, AsyncBufReadExt};
Expand Down Expand Up @@ -52,7 +53,7 @@ async fn parse_command(s: &str) -> io::Result<Command> {
}

async fn process_commands(store_path: &str, graph: &str) -> io::Result<()> {
let store = open_directory_store(store_path);
let store = open_directory_store(store_path, NoFilenameEncoding);
let graph = store
.open(graph)
.await?
Expand Down
Loading