Skip to main content

Crate oak_core

Crate oak_core 

Source

Re-exports§

pub use change_set::CanonicalChangeSetV1;
pub use change_set::CanonicalPathChangeV1;
pub use change_set::ChangeScopeV1;
pub use change_set::ChangeStateV1;
pub use change_set::CHANGE_SET_OBJECT_FORMAT_V1;
pub use chunking::blob_chunk_mapping;
pub use chunking::chunk_content;
pub use chunking::reassemble_chunks;
pub use chunking::stream_chunk_content;
pub use chunking::BlobChunkMapping;
pub use chunking::ChunkInfo;
pub use chunking::chunk_decode;
pub use chunking::chunk_decode_limited;
pub use chunking::chunk_encode;
pub use diff::binary_or_large_notice;
pub use diff::binary_or_oversize_notice;
pub use diff::inline_diff_ranges;
pub use diff::is_binary;
pub use diff::DiffLine;
pub use diff::FileDiff;
pub use diff::Hunk;
pub use diff::DEFAULT_CONTEXT_LINES;
pub use diff::MAX_TEXT_DIFF_BYTES;
pub use error::CommitPhaseError;
pub use error::DescriptionStaleState;
pub use error::ErrorCode;
pub use error::ExitCode;
pub use error::FinishBlocker;
pub use error::FinishPhaseError;
pub use error::FinishPreflightError;
pub use error::MissingApproval;
pub use error::OakError;
pub use error::OakErrorKind;
pub use error::Result;
pub use error::RootRefusal;
pub use error::WorktreeTransition;
pub use hash::hash_bytes;
pub use hash::hash_string;
pub use hash::Hash;
pub use hash::HashKind;
pub use hash_format::HashFormat;
pub use ignore::is_system_metadata_path;
pub use ignore::root_dirs;
pub use ignore::IgnorePatterns;
pub use ignore::ROOT_DIRS_FILE;
pub use ignore::ROOT_STATE_FILE;
pub use ignore::TRACKED_OAK_FILES;
pub use merge::three_way_merge_manifests;
pub use merge::three_way_merge_text;
pub use merge::three_way_merge_trees;
pub use merge::MergeConflict;
pub use merge::MergeOutcome;
pub use merge::TextMerge;
pub use merge::TreeMergeOutcome;
pub use sparse::SparseCone;
pub use tree::build_tree;
pub use tree::collect_tree_objects;
pub use tree::diff_tree_entries;
pub use tree::diff_trees;
pub use tree::edit_tree;
pub use tree::flatten_tree;
pub use tree::is_metadata_dir_component;
pub use tree::normalize_path;
pub use tree::resolve_path;
pub use tree::subtree_at_path;
pub use tree::validate_entry_name;
pub use tree::validate_tree_path;
pub use tree::validate_worktree_path;
pub use tree::worktree_path_problem;
pub use tree::BuiltTree;
pub use tree::Tree;
pub use tree::TreeEntry;
pub use tree::TreeEntryKind;
pub use view::derive_view_commit;
pub use view::graft_tree;
pub use view::prune_tree;
pub use view::DerivedViewCommit;
pub use view::ViewSpec;
pub use view::VIEW_PROTOCOL;
pub use git::GitRepository;
pub use sqlite::BulkImporter;
pub use sqlite::ChangeCaptureProvenance;
pub use sqlite::CompactStats;
pub use sqlite::SqliteRepository;
pub use sqlite::StoredBlobReader;
pub use sqlite::StoredChangeCapture;
pub use traits::BlobSource;
pub use traits::Repository;
pub use traits::StatCacheEntry;

Modules§

change_set
Canonical identity for an immutable set of file-state changes.
chunking
diff
error
git
Repository implementation backed by a real .git directory.
hash
hash_format
Content-addressing format versions: the v1 (current) and v2 (prepared, dormant) hash preimages for every Oak object kind.
ignore
merge
Pure 3-way merge of manifests.
protocol
Wire protocol DTOs for the push/pull/clone sync protocol (shared by the CLI client and the hosted server). Not gated behind local-repo — server-side consumers need it with default-features = false. Wire protocol types for the Oak push/pull/clone sync protocol.
sparse
Sparse-checkout cone matching (Perforce-style partial clones). Pure path logic with no I/O, so it is available to both the CLI client and any server-side consumer without the local-repo feature. Sparse-checkout cones — Perforce-style partial clones.
sqlite
traits
tree
Tree-structured manifests.
view
Views: pruned, hash-verifiable slices of a repository (partial clones and mounts, restricted readers). Pure tree logic, no I/O. Views — pruned, hash-verifiable slices of a repository.

Macros§

closed_vocabulary
Generates a closed, field-less enum together with its complete ALL list and its stable wire string, from one table. Adding an entry here is the only way to add a value, so ALL can never fall out of sync.

Structs§

Blob
A content-addressed blob (file content)
Branch
A branch (container for commits)
BranchRename
A single rename event in the server’s append-only rename log. Returned in pull responses so other clients can replay the rename against their local repo before applying new commits.
Commit
A commit within a branch.
FileChange
A file change in a commit
Manifest
A manifest represents the complete state of the repository at a point in time
ManifestEntry
An entry in a manifest (a file at a specific path)
RenameConfig
Configuration for rename detection heuristics
StackNode
What validate_stack_parent needs to know about one branch.
UnreadableBranch
A stored branch row that exists but whose metadata cannot be decoded (for example a corrupt created_at). Listing callers get one of these per bad row instead of the whole listing failing (fb-118).

Enums§

BranchStatus
Status of a branch
ChangeType
Type of change to a file
CloseReason
Explicit audit reason recorded when a branch is closed via oak close.
FileMode
File mode/permissions
MetadataKey
Repository metadata key-value pairs
StackParentError
Why a proposed parent is not a legal place to stack a branch.

Constants§

BRANCH_METADATA_UNREADABLE
Stable code for a stored branch row whose metadata cannot be decoded.
DEFAULT_BRANCH
The repository trunk. Every branch ultimately lands here: a branch either parents directly onto the trunk, or is stacked on another open branch whose chain of parents ends at the trunk (main <- a <- b). Stacks land bottom-up: when a stacked branch’s parent merges (or closes), the server restacks it onto the parent’s own parent, so it eventually parents onto the trunk again.
LARGE_FILE_THRESHOLD
Files larger than this threshold are transferred separately during push/pull for better performance and memory efficiency.
MAX_STACK_DEPTH
How deep a stack may be (branches between the trunk and the tip, inclusive). Bounds parent-chain walks against corrupt or cyclic metadata.

Functions§

content_similarity
Compute a content-similarity score between two byte slices (0.0-1.0).
detect_renames_by_content
Promote Add+Delete pairs in changes to Renamed when their contents are similar enough. get_content is called with each candidate’s blob hash; returning Ok(None) (missing blob) silently skips that candidate.
ensure_empty_blob
Store the zero-byte blob locally if hash names it; report whether it did.
ensure_empty_blobs_in_manifest
Run ensure_empty_blob for every entry of manifest, so a subsequent “is every blob present?” sweep sees the empty blob as available.
parse_stored_timestamp
Decode a stored branch/tag timestamp.
truncate_to_micros
Truncate a timestamp to microsecond precision — the precision of the lowest-fidelity store a commit row must survive (Postgres TIMESTAMPTZ). Hash preimages must only ever embed timestamps every store can reproduce.
validate_manifest_transition
Validate that a commit’s file-change records describe exactly the transition from parent to current.
validate_stack_parent
Check that branch may be parented onto parent.