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//! - `permissions` - An optional permission layer with rules stored in links
27//! - `undoable_links` - Writes kept to be undone, so a failed request leaves nothing
28//! - `types` - A type hierarchy with sub-types and multiple inheritance
29//! - `transactions`, `version_control` - Reversible transitions, branches and tags
30//! - `union_links` - Many networks seen as one, the first member shadowing the rest
31//! - `remap_links` - A network under other addresses: an offset or a table
32//! - `external_ids` - The ids of other systems (UUIDs, URLs) bound to links
33//! - `cli` - Argument parsing, so a custom tool can accept the same options
34//!
35//! # Extending
36//!
37//! [`NamedTypeLinks`] is the seam: every layer of the stack is written against
38//! it, and every decorator both implements it and wraps another implementation
39//! of it. A layer of your own -- a cache, an access check, a remote store --
40//! implements the trait and slots in anywhere, including under
41//! [`QueryProcessor`], which never learns what is beneath it.
42
43pub mod changes_simplifier;
44pub mod cli;
45pub mod error;
46pub mod external_ids;
47pub mod hybrid_reference;
48pub mod indexed_links;
49pub mod link;
50pub mod link_reference_validator;
51pub mod link_storage;
52pub mod link_storage_doublets;
53pub mod lino_database_input;
54pub mod lino_link;
55pub mod named_links;
56pub mod named_type_links;
57pub mod named_types;
58pub mod parser;
59pub mod permissions;
60pub mod persistent_transformations;
61pub mod pinned_types;
62pub mod protocol;
63pub mod query_options;
64mod query_parser;
65pub mod query_processor;
66pub mod query_processor_substitution;
67pub mod query_types;
68pub mod remap_links;
69pub mod sequences;
70pub mod storage;
71pub mod transactions;
72pub mod types;
73pub mod undoable_links;
74pub mod unicode_string_storage;
75pub mod union_links;
76pub mod version_control;
77
78/// The `doublets` crate this library is built on, re-exported so
79/// downstream crates can name upstream types (stores, decorators,
80/// `LinkReference` implementations) without adding their own dependency
81/// and risking a version mismatch.
82pub use doublets;
83
84// Re-export main types for easy access
85pub use changes_simplifier::simplify_changes;
86pub use error::LinkError;
87pub use external_ids::{LinksExternalIds, EXTERNAL_ID_NAME};
88pub use hybrid_reference::{external_reference, external_reference_value, HybridReference};
89pub use indexed_links::IndexedLinksDecorator;
90pub use link::{DoubletsLink, GenericLink, Link};
91pub use link_storage::LinkStorage;
92pub use link_storage_doublets::link_storage_constants;
93pub use lino_database_input::{import_lino_file, import_lino_text};
94pub use lino_link::LinoLink;
95pub use named_links::NamedLinks;
96pub use named_type_links::NamedTypeLinks;
97pub use named_types::{NamedTypes, NamedTypesDecorator};
98pub use parser::Parser;
99pub use permissions::{
100    AccessPolicy, Forbidden, LinksTokenTable, PermissionAccess, PermissionMarkers,
101    PermissionPolicy, PermissionsDecorator,
102};
103pub use persistent_transformations::{
104    make_triggers_database_filename, PersistentTransformation, PersistentTransformationDecorator,
105    PersistentTransformationKind, PersistentTransformationQuery, TriggerStore,
106    INTERNAL_NAME_PREFIX,
107};
108pub use pinned_types::{PinnedTypes, PinnedTypesAccess, PinnedTypesDecorator};
109pub use protocol::{
110    BinaryLinoOptions, BinaryLinoProtocol, LinksClient, LinksServer, LinoProtocol, TextLinoProtocol,
111};
112pub use query_options::QueryOptions;
113pub use query_processor::{Changes, QueryProcessor};
114pub use remap_links::{AddressMap, AddressTable, OffsetAddressMap, RemapLinks};
115pub use storage::{
116    decorators, lock_file_path, DoubletsStorage, FileLock, FileMappedUnitStore, FileMappedValue,
117    LinksStorage, LinksStorageRef, LockMode, NamedLinksStorage, PersistentFileMapped,
118    ResolvedFileMappedUnitStore, StorageRevision,
119};
120pub use transactions::{
121    CommitMode, DoubletLink, FileTransitionLog, GenericDoubletLink, GenericTransactionsDecorator,
122    GenericTransition, LogRetentionPolicy, TransactionHandle, TransactionsDecorator, Transition,
123    TransitionKind, TransitionLogStore,
124};
125pub use types::{ensure_point, TypeMarkers, Types, TypesDecorator, EXTENDS_NAME, ROOT_TYPE_NAME};
126pub use undoable_links::{LinkChange, LinksUndoLog, UndoableLinksDecorator};
127pub use unicode_string_storage::UnicodeStringStorage;
128pub use union_links::{UnionLinks, UnionMember};
129pub use version_control::{BranchInfo, VersionControlDecorator, DEFAULT_BRANCH_NAME};