History

minor improvements to module layout, docs (#266)

Sebastian Thiel committed 4 years ago

Commit 0364f481 parent 360bf9d5 files · +17 −33Browse files

Unified · Split

5 files
  1. experiments/object-access/src/main.rs +1 −0
  2. git-odb/src/find.rs +2 −17
  3. git-odb/src/lib.rs +10 −15
  4. git-odb/src/store/compound/mod.rs +3 −1
  5. git-odb/src/store/linked/mod.rs +1 −0
experiments/object-access/src/main.rs+1−0
@@ -503,6 +503,7 @@ where · 502 unmodified lines
503503 {
504504 use git_repository::prelude::FindExt;
505505 let bytes = std::sync::atomic::AtomicU64::default();
506+ #[allow(deprecated)]
506507 let odb = Arc::new(git_repository::odb::linked::Store::at(objects_dir)?);
507508
508509 git_repository::parallel::in_parallel(
git-odb/src/find.rs+2−17
@@ -17,7 +17,7 @@ pub mod existing { · 16 unmodified lines
1717 pub mod existing_object {
1818 use git_hash::ObjectId;
1919
20− /// The error returned by the various [`find_*`][crate::FindExt::find_commit()] trait methods.
20+ /// The error returned by the various [`find_*()`][crate::FindExt::find_commit()] trait methods.
2121 #[derive(Debug, thiserror::Error)]
2222 #[allow(missing_docs)]
2323 pub enum Error<T: std::error::Error + 'static> {
@@ -36,7 +36,7 @@ pub mod existing_object { · 12 unmodified lines
3636 pub mod existing_iter {
3737 use git_hash::ObjectId;
3838
39− /// The error returned by the various [`find_*`][crate::FindExt::find_commit()] trait methods.
39+ /// The error returned by the various [`find_*_iter()`][crate::FindExt::find_commit_iter()] trait methods.
4040 #[derive(Debug, thiserror::Error)]
4141 #[allow(missing_docs)]
4242 pub enum Error<T: std::error::Error + 'static> {
@@ -48,18 +48,3 @@ pub mod existing_iter { · 5 unmodified lines
4848 ObjectKind { expected: git_object::Kind },
4949 }
5050 }
51−
52−/// An Entry in a pack providing access to its data.
53−///
54−/// Its commonly retrieved by reading from a pack index file followed by a read from a pack data file.
55−#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
56−#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
57−#[allow(missing_docs)]
58−pub struct Entry<'a> {
59− /// The pack-data encoded bytes of the pack data entry as present in the pack file, including the header followed by compressed data.
60− pub data: &'a [u8],
61− /// The crc32 hash over the entirety of `data`, or None if the pack file format doesn't support it yet.
62− pub crc32: Option<u32>,
63− /// The version of the pack file containing `data`
64− pub version: crate::pack::data::Version,
65−}
git-odb/src/lib.rs+10−15
@@ -1,20 +1,15 @@
11 #![deny(missing_docs, unsafe_code, rust_2018_idioms)]
22
3−//! Git stores all of its data as _Objects_, which ata along with a hash over all data. Thus it's an
4−//! object store indexed by data with inherent deduplication: the same data will have the same hash, and thus occupy the same
5−//! space within the store.
3+//! Git stores all of its data as _Objects_, which are data along with a hash over all data. Thus it's an
4+//! object store indexed by the signature of data itself with inherent deduplication: the same data will have the same hash,
5+//! and thus occupy the same space within the store.
66 //!
7−//! There are various flavours of object stores, all of which supporting iteration, reading and possibly writing.
7+//! There is only one all-round object store, also known as the [`Store`], as it supports ~~everything~~ most of what git has to offer.
88 //!
9−//! * [`loose::Store`]
10−//! * A database storing one object per file, named by its hash, using zlib compression.
11−//! * O(1) reads and writes, bound by IO operations per second
12−//! * [`compound::Store`]
13−//! * A database using a [`loose::Store`] for writes and multiple [`pack::Bundle`]s for object reading. It can also refer to multiple
14−//! additional [`compound::Store`] instances using git-alternates.
15−//! * This is the database closely resembling the object database in a git repository, and probably what most people would want to use.
16−//! * [`linked::Store`]
17−//! * A database containing various [`compound::Stores`][compound::Store] as gathered from `alternates` files.
9+//! * loose object reading and writing
10+//! * access to packed objects
11+//! * multiple loose objects and pack locations as gathered from `alternates` files.
12+#![allow(deprecated)] // TODO: actually remove the deprecated items and remove thos allow
1813 use std::path::PathBuf;
1914 use std::sync::Arc;
2015
@@ -28,13 +23,13 @@ pub mod alternate; · 7 unmodified lines
2823
2924 /// A thread-local handle to access any object.
3025 pub type Handle = Cache<general::Handle<OwnShared<general::Store>>>;
31−/// A thread-local handle to access any object, but thread-safe and independent of the actual type of OwnShared.
26+/// A thread-local handle to access any object, but thread-safe and independent of the actual type of `OwnShared` or feature toggles in `git-features`.
3227 pub type HandleArc = Cache<general::Handle<Arc<general::Store>>>;
3328
3429 /// A thread-safe store for creation of handles.
3530 pub type Store = general::Store;
3631
37−/// Create a new cached odb handle.
32+/// Create a new cached odb handle with support for additional options.
3833 pub fn at_opts(objects_dir: impl Into<PathBuf>, slots: general::init::Slots) -> std::io::Result<Handle> {
3934 let handle =
4035 OwnShared::new(general::Store::at_opts(objects_dir, slots)?).to_handle(RefreshMode::AfterAllIndicesLoaded);
git-odb/src/store/compound/mod.rs+3−1
@@ -7,8 +7,10 @@ pub mod find; · 6 unmodified lines
77 pub mod init;
88 mod write;
99
10−/// An object database with tiered lookup packs and loose objects.
10+/// A static object database with tiered lookup in packs and loose objects.
1111 /// This is a typical git database as used in git repositories, sans 'alternates'.
12+/// Note that this ODB won't detect changes on disk and will eagerly map all relevant files. Multipack indices are not supported either.
13+#[deprecated(since = "0.27", note = "superseded by git_odb::Store")]
1214 pub struct Store {
1315 /// A loose object database into which new objects are written
1416 pub loose: loose::Store,
git-odb/src/store/linked/mod.rs+1−0
@@ -6,6 +6,7 @@ use crate::store::compound; · 5 unmodified lines
66 /// It does not contain any objects itself.
77 ///
88 /// Furthermore, it won't handle multi-pack indices and might be removed at some point in the future to allow focussing on a single database.
9+#[deprecated(since = "0.27", note = "superseded by git_odb::Store")]
910 pub struct Store {
1011 /// The compound databases containing the actual objects.
1112 pub dbs: Vec<compound::Store>,