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//! - `types` - A type hierarchy with sub-types and multiple inheritance
27//! - `transactions`, `version_control` - Reversible transitions, branches and tags
28//! - `cli` - Argument parsing, so a custom tool can accept the same options
29//!
30//! # Extending
31//!
32//! [`NamedTypeLinks`] is the seam: every layer of the stack is written against
33//! it, and every decorator both implements it and wraps another implementation
34//! of it. A layer of your own -- a cache, an access check, a remote store --
35//! implements the trait and slots in anywhere, including under
36//! [`QueryProcessor`], which never learns what is beneath it.
37
38pub mod changes_simplifier;
39pub mod cli;
40pub mod error;
41pub mod hybrid_reference;
42pub mod indexed_links;
43pub mod link;
44pub mod link_reference_validator;
45pub mod link_storage;
46pub mod link_storage_doublets;
47pub mod lino_database_input;
48pub mod lino_link;
49pub mod named_links;
50pub mod named_type_links;
51pub mod named_types;
52pub mod parser;
53pub mod persistent_transformations;
54pub mod pinned_types;
55pub mod protocol;
56pub mod query_options;
57mod query_parser;
58pub mod query_processor;
59pub mod query_processor_substitution;
60pub mod query_types;
61pub mod sequences;
62pub mod storage;
63pub mod transactions;
64pub mod types;
65pub mod unicode_string_storage;
66pub mod version_control;
67
68/// The `doublets` crate this library is built on, re-exported so
69/// downstream crates can name upstream types (stores, decorators,
70/// `LinkReference` implementations) without adding their own dependency
71/// and risking a version mismatch.
72pub use doublets;
73
74// Re-export main types for easy access
75pub use changes_simplifier::simplify_changes;
76pub use error::LinkError;
77pub use hybrid_reference::{external_reference, external_reference_value, HybridReference};
78pub use indexed_links::IndexedLinksDecorator;
79pub use link::{DoubletsLink, GenericLink, Link};
80pub use link_storage::LinkStorage;
81pub use link_storage_doublets::link_storage_constants;
82pub use lino_database_input::{import_lino_file, import_lino_text};
83pub use lino_link::LinoLink;
84pub use named_links::NamedLinks;
85pub use named_type_links::NamedTypeLinks;
86pub use named_types::{NamedTypes, NamedTypesDecorator};
87pub use parser::Parser;
88pub use persistent_transformations::{
89    make_triggers_database_filename, PersistentTransformation, PersistentTransformationDecorator,
90    PersistentTransformationKind, PersistentTransformationQuery, TriggerStore,
91    INTERNAL_NAME_PREFIX,
92};
93pub use pinned_types::{PinnedTypes, PinnedTypesAccess, PinnedTypesDecorator};
94pub use protocol::{
95    BinaryLinoOptions, BinaryLinoProtocol, LinksClient, LinksServer, LinoProtocol, TextLinoProtocol,
96};
97pub use query_options::QueryOptions;
98pub use query_processor::{Changes, QueryProcessor};
99pub use storage::{
100    decorators, lock_file_path, DoubletsStorage, FileLock, FileMappedUnitStore, FileMappedValue,
101    LinksStorage, LinksStorageRef, LockMode, PersistentFileMapped, ResolvedFileMappedUnitStore,
102    StorageRevision,
103};
104pub use transactions::{
105    CommitMode, DoubletLink, FileTransitionLog, GenericDoubletLink, GenericTransactionsDecorator,
106    GenericTransition, LogRetentionPolicy, TransactionHandle, TransactionsDecorator, Transition,
107    TransitionKind, TransitionLogStore,
108};
109pub use types::{ensure_point, TypeMarkers, Types, TypesDecorator, EXTENDS_NAME, ROOT_TYPE_NAME};
110pub use unicode_string_storage::UnicodeStringStorage;
111pub use version_control::{BranchInfo, VersionControlDecorator, DEFAULT_BRANCH_NAME};