Skip to main content

link_cli/
lib.rs

1//! Link CLI Library - Core functionality for links manipulation
2//!
3//! This library provides the core data structures and functionality
4//! for the link-cli tool, implementing a doublet storage system
5//! with LiNo notation support.
6//!
7//! # Modules
8//!
9//! Every module is public: `clink` is one front end over this library, and an
10//! application that needs a different one should be able to reach the same
11//! pieces rather than reimplement them.
12//!
13//! - `link` - The core Link data structure
14//! - `error` - Error types for link operations
15//! - `lino_link` - LiNo link representation
16//! - `parser` - LiNo notation parser
17//! - `link_storage` - Persistent link storage
18//! - `storage` - Reusable storage traits and the doublets-backed store
19//! - `changes_simplifier` - Changes simplification
20//! - `query_processor` - LiNo query processing
21//! - `query_types` - Patterns and resolved links, the shapes a query passes through
22//! - `link_reference_validator` - Checking, and optionally creating, referenced links
23//! - `named_type_links` - The storage interface every layer is written against
24//! - `named_types`, `pinned_types` - Named and pinned type decorators
25//! - `persistent_transformations` - Persistent transformation triggers
26//! - `transactions`, `version_control` - Reversible transitions, branches and tags
27//! - `cli` - Argument parsing, so a custom tool can accept the same options
28//!
29//! # Extending
30//!
31//! [`NamedTypeLinks`] is the seam: every layer of the stack is written against
32//! it, and every decorator both implements it and wraps another implementation
33//! of it. A layer of your own -- a cache, an access check, a remote store --
34//! implements the trait and slots in anywhere, including under
35//! [`QueryProcessor`], which never learns what is beneath it.
36
37pub mod changes_simplifier;
38pub mod cli;
39pub mod error;
40pub mod hybrid_reference;
41pub mod link;
42pub mod link_reference_validator;
43pub mod link_storage;
44pub mod link_storage_doublets;
45pub mod lino_database_input;
46pub mod lino_link;
47pub mod named_links;
48pub mod named_type_links;
49pub mod named_types;
50pub mod parser;
51pub mod persistent_transformations;
52pub mod pinned_types;
53pub mod query_options;
54pub mod query_processor;
55pub mod query_processor_substitution;
56pub mod query_types;
57pub mod sequences;
58pub mod storage;
59pub mod transactions;
60pub mod unicode_string_storage;
61pub mod version_control;
62
63/// The `doublets` crate this library is built on, re-exported so
64/// downstream crates can name upstream types (stores, decorators,
65/// `LinkReference` implementations) without adding their own dependency
66/// and risking a version mismatch.
67pub use doublets;
68
69// Re-export main types for easy access
70pub use changes_simplifier::simplify_changes;
71pub use error::LinkError;
72pub use hybrid_reference::{external_reference, external_reference_value, HybridReference};
73pub use link::{DoubletsLink, GenericLink, Link};
74pub use link_storage::LinkStorage;
75pub use link_storage_doublets::link_storage_constants;
76pub use lino_database_input::{import_lino_file, import_lino_text};
77pub use lino_link::LinoLink;
78pub use named_links::NamedLinks;
79pub use named_type_links::NamedTypeLinks;
80pub use named_types::{NamedTypes, NamedTypesDecorator};
81pub use parser::Parser;
82pub use persistent_transformations::{
83    make_triggers_database_filename, PersistentTransformation, PersistentTransformationDecorator,
84    PersistentTransformationKind, PersistentTransformationQuery, TriggerStore,
85    INTERNAL_NAME_PREFIX,
86};
87pub use pinned_types::{PinnedTypes, PinnedTypesAccess, PinnedTypesDecorator};
88pub use query_options::QueryOptions;
89pub use query_processor::QueryProcessor;
90pub use storage::{
91    decorators, lock_file_path, DoubletsStorage, FileLock, FileMappedUnitStore, LinksStorage,
92    LinksStorageRef, LockMode, PersistentFileMapped, ResolvedFileMappedUnitStore, StorageRevision,
93};
94pub use transactions::{
95    CommitMode, DoubletLink, FileTransitionLog, GenericDoubletLink, GenericTransactionsDecorator,
96    GenericTransition, LogRetentionPolicy, TransactionHandle, TransactionsDecorator, Transition,
97    TransitionKind, TransitionLogStore,
98};
99pub use unicode_string_storage::UnicodeStringStorage;
100pub use version_control::{BranchInfo, VersionControlDecorator, DEFAULT_BRANCH_NAME};