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