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 indexed_links;
42pub mod link;
43pub mod link_reference_validator;
44pub mod link_storage;
45pub mod link_storage_doublets;
46pub mod lino_database_input;
47pub mod lino_link;
48pub mod named_links;
49pub mod named_type_links;
50pub mod named_types;
51pub mod parser;
52pub mod persistent_transformations;
53pub mod pinned_types;
54pub mod protocol;
55pub mod query_options;
56pub mod query_processor;
57pub mod query_processor_substitution;
58pub mod query_types;
59pub mod sequences;
60pub mod storage;
61pub mod transactions;
62pub mod unicode_string_storage;
63pub mod version_control;
64
65/// The `doublets` crate this library is built on, re-exported so
66/// downstream crates can name upstream types (stores, decorators,
67/// `LinkReference` implementations) without adding their own dependency
68/// and risking a version mismatch.
69pub use doublets;
70
71// Re-export main types for easy access
72pub use changes_simplifier::simplify_changes;
73pub use error::LinkError;
74pub use hybrid_reference::{external_reference, external_reference_value, HybridReference};
75pub use indexed_links::IndexedLinksDecorator;
76pub use link::{DoubletsLink, GenericLink, Link};
77pub use link_storage::LinkStorage;
78pub use link_storage_doublets::link_storage_constants;
79pub use lino_database_input::{import_lino_file, import_lino_text};
80pub use lino_link::LinoLink;
81pub use named_links::NamedLinks;
82pub use named_type_links::NamedTypeLinks;
83pub use named_types::{NamedTypes, NamedTypesDecorator};
84pub use parser::Parser;
85pub use persistent_transformations::{
86    make_triggers_database_filename, PersistentTransformation, PersistentTransformationDecorator,
87    PersistentTransformationKind, PersistentTransformationQuery, TriggerStore,
88    INTERNAL_NAME_PREFIX,
89};
90pub use pinned_types::{PinnedTypes, PinnedTypesAccess, PinnedTypesDecorator};
91pub use protocol::{
92    BinaryLinoOptions, BinaryLinoProtocol, LinksClient, LinksServer, LinoProtocol, TextLinoProtocol,
93};
94pub use query_options::QueryOptions;
95pub use query_processor::{Changes, QueryProcessor};
96pub use storage::{
97    decorators, lock_file_path, DoubletsStorage, FileLock, FileMappedUnitStore, FileMappedValue,
98    LinksStorage, LinksStorageRef, LockMode, PersistentFileMapped, ResolvedFileMappedUnitStore,
99    StorageRevision,
100};
101pub use transactions::{
102    CommitMode, DoubletLink, FileTransitionLog, GenericDoubletLink, GenericTransactionsDecorator,
103    GenericTransition, LogRetentionPolicy, TransactionHandle, TransactionsDecorator, Transition,
104    TransitionKind, TransitionLogStore,
105};
106pub use unicode_string_storage::UnicodeStringStorage;
107pub use version_control::{BranchInfo, VersionControlDecorator, DEFAULT_BRANCH_NAME};