fsblobstore

Check-in Differences
Login

Check-in Differences

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From fsblobstore-0.0.3 To fsblobstore-0.0.4

2024-09-21
11:00
Update dependencies. check-in: f346678cce user: jan tags: trunk
2024-01-30
16:39
Happy Clippy. check-in: c017f1d615 user: jan tags: fsblobstore-0.0.4, trunk
16:34
Happy clippy. check-in: d97283fae2 user: jan tags: trunk
16:14
Update changelog. check-in: 963d3786c6 user: jan tags: trunk
00:03
Update changelog. check-in: f0afcba861 user: jan tags: fsblobstore-0.0.3, trunk
00:02
Update to tmpfile 0.0.2. Add a factory method to use the 'small file' support of tmpfile. check-in: ef3e8cd6e8 user: jan tags: trunk

Changes to Cargo.toml.

1
2
3

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


-
+



















+







[package]
name = "fsblobstore"
version = "0.0.3"
version = "0.0.4"
edition = "2021"
license = "0BSD"
categories = [ "filesystem" ]
keywords = [ "blob", "datastore" ]
repository = "https://repos.qrnch.tech/pub/fsblobstore"
description = "A file-system backed blob storage abstraction."
rust-version = "1.56"
exclude = [
  ".fossil-settings",
  ".efiles",
  ".fslckout",
  "datastore",
  "www",
  "rustfmt.toml"
]

[features]
enumerate = ["dep:recstrm", "dep:walkdir"]
get-fname = []
mkbasedir = []

[dependencies]
hex = { version = "0.4.3" }
idbag = { version = "0.1.2" }
recstrm = { version = "0.0.1", optional = true }
sha2 =  { version = "0.10.8" }
tmpfile = { version = "0.0.2" }

Changes to examples/rmall.rs.

1
2
3

4
5
6
7
8
9
10
11
12

13
14

15
16
17

18
19
20
21
22
23
24
1
2

3
4
5
6
7
8
9
10
11
12
13
14

15
16
17

18
19
20
21
22
23
24
25


-
+









+

-
+


-
+







#[cfg(feature = "enumerate")]
mod inner {
  use std::{env, fs};
  use std::env;

  use fsblobstore::FsBlobStore;

  pub(super) fn main() {
    //
    // Set up datastore base directory
    //
    let curdir = env::current_dir().unwrap();
    let datastoredir = curdir.join("datastore");
    #[cfg(not(feature = "mkbasedir"))]
    if !datastoredir.exists() {
      fs::create_dir(&datastoredir).unwrap();
      std::fs::create_dir_all(&datastoredir).unwrap();
    }

    let bs = FsBlobStore::new(&datastoredir).unwrap();
    let bs = FsBlobStore::new(datastoredir).unwrap();

    //
    // Enumerate all keys in content store
    //
    let (rx, jh) = bs.enumerate();

    let mut keys = Vec::new();

Changes to examples/simple.rs.

1

2
3
4
5
6
7
8
9
10
11
12

13
14

15
16
17

18
19
20
21
22
23
24

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17

18
19
20
21
22
23
24
25
-
+











+

-
+


-
+







use std::{env, fs, io::Write};
use std::{env, io::Write};

use fsblobstore::FsBlobStore;

use rand::Rng;

fn main() {
  //
  // Set up datastore base directory
  //
  let curdir = env::current_dir().unwrap();
  let datastoredir = curdir.join("datastore");
  #[cfg(not(feature = "mkbasedir"))]
  if !datastoredir.exists() {
    fs::create_dir(&datastoredir).unwrap();
    std::fs::create_dir_all(&datastoredir).unwrap();
  }

  let bs = FsBlobStore::new(&datastoredir).unwrap();
  let bs = FsBlobStore::new(datastoredir).unwrap();

  //
  // Create a random buffer to be used as file contents
  //
  let mut buf = vec![0u8; 65536];
  rand::thread_rng().fill(&mut buf[..]);

Changes to src/lib.rs.

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16








+







//! A abstraction over a filesystem blob storage where each blob is
//! named/key'd by its own hash.
//!
//! # Features
//! | Feature     | Function
//! |-------------|----------
//! | `enumerate` | Enable method for enumerating all keys in storage.
//! | `get-fname` | Enable method for acquiring the path of a blob.
//! | `mkbasedir` | Auto-create the base directory in factory methods.
//!
//! The use of the `enumerate` and `get-fname` features are discouraged since
//! they may encourage breaking the intended usage pattern for `FsBlobStore`
//! instances.

#![cfg_attr(docsrs, feature(doc_cfg))]

117
118
119
120
121
122
123


124
125






126
127
128
129
130
131
132
133
134
135
136
137






138
139
140
141
142
143
144
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159







+
+


+
+
+
+
+
+












+
+
+
+
+
+








impl FsBlobStore {
  /// Create a new file system-backed blob storage engine.
  ///
  /// The `basedir` is where the blobs and temporary files will be stored.  The
  /// caller must ensure that either `basedir` is absolute, or that the path
  /// remains valid throughout the object's lifetime.
  ///
  /// If the basedir does not exist, the
  pub fn new(basedir: impl AsRef<Path>) -> Result<Self, Error> {
    let basedir = basedir.as_ref();

    #[cfg(feature = "mkbasedir")]
    if !basedir.exists() {
      fs::create_dir_all(basedir)?;
    }

    Ok(Self {
      basedir: basedir.to_path_buf(),
      minsize: None,
      idbag: IdBag::new()
    })
  }

  pub fn with_minsize(
    basedir: impl AsRef<Path>,
    minsize: usize
  ) -> Result<Self, Error> {
    let basedir = basedir.as_ref();

    #[cfg(feature = "mkbasedir")]
    if !basedir.exists() {
      fs::create_dir_all(basedir)?;
    }

    Ok(Self {
      basedir: basedir.to_path_buf(),
      minsize: Some(minsize),
      idbag: IdBag::new()
    })
  }

Changes to www/changelog.md.

1
2
3
4
5
























6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
1
2
3
4

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39


40
41
42
43
44
45
46




-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+











-
-







# Change Log

## [Unreleased]

[Details](/vdiff?from=fsblobstore-0.0.2&to=trunk)
[Details](/vdiff?from=fsblobstore-0.0.4&to=trunk)

### Added

### Changed

### Removed

---

## [0.0.4] - 2024-01-30

[Details](/vdiff?from=fsblobstore-0.0.3&to=fsblobstore-0.0.4)

### Changed

- Update factory methods to create base directory if it doesn't exists, if the
  `mkbasedir` feature is enabled.

---

## [0.0.3] - 2024-01-30

[Details](/vdiff?from=fsblobstore-0.0.2&to=fsblobstore-0.0.3)

### Added

- Add factory method `FsBlobStore::with_minsize()` to be able to use the memory
  buffer for "small files" support introduced in `tmpfile` 0.0.2.
- Re-export `tmpfile` to allow application to access `tmpfile::Output`.

### Changed

- Update to `tmpfile` 0.0.2.

### Removed

---

## [0.0.2] - 2024-01-29

[Details](/vdiff?from=fsblobstore-0.0.1&to=fsblobstore-0.0.2)

### Added