Expand description
Link CLI Library - Core functionality for links manipulation
This library provides the core data structures and functionality for the link-cli tool, implementing a doublet storage system with LiNo notation support.
§Modules
Every module is public: clink is one front end over this library, and an
application that needs a different one should be able to reach the same
pieces rather than reimplement them.
link- The core Link data structureerror- Error types for link operationslino_link- LiNo link representationparser- LiNo notation parserlink_storage- Persistent link storagestorage- Reusable storage traits and the doublets-backed storechanges_simplifier- Changes simplificationquery_processor- LiNo query processingquery_types- Patterns and resolved links, the shapes a query passes throughlink_reference_validator- Checking, and optionally creating, referenced linksnamed_type_links- The storage interface every layer is written againstnamed_types,pinned_types- Named and pinned type decoratorspersistent_transformations- Persistent transformation triggerspermissions- An optional permission layer with rules stored in linksundoable_links- Writes kept to be undone, so a failed request leaves nothingtypes- A type hierarchy with sub-types and multiple inheritancetriplets- Triplets(index: type from to)stored in doublets, with substitution and LiNotransactions,version_control- Reversible transitions, branches and tagsunion_links- Many networks seen as one, the first member shadowing the restcache_links- A store as a cache: links that expire and bounded capacityremap_links- A network under other addresses: an offset or a tableexternal_ids- The ids of other systems (UUIDs, URLs) bound to linksgraphql- A Hasura-compatible GraphQL server for the Deep standardcli- Argument parsing, so a custom tool can accept the same options
§Extending
NamedTypeLinks is the seam: every layer of the stack is written against
it, and every decorator both implements it and wraps another implementation
of it. A layer of your own – a cache, an access check, a remote store –
implements the trait and slots in anywhere, including under
QueryProcessor, which never learns what is beneath it.
Re-exports§
pub use cache_links::CacheLinks;pub use cache_links::CacheOptions;pub use changes_simplifier::simplify_changes;pub use error::LinkError;pub use external_ids::LinksExternalIds;pub use external_ids::EXTERNAL_ID_NAME;pub use hybrid_reference::external_reference;pub use hybrid_reference::external_reference_value;pub use hybrid_reference::HybridReference;pub use indexed_links::IndexedLinksDecorator;pub use link::DoubletsLink;pub use link::GenericLink;pub use link::Link;pub use link_storage::LinkStorage;pub use link_storage_doublets::link_storage_constants;pub use lino_database_input::import_lino_file;pub use lino_database_input::import_lino_text;pub use lino_link::LinoLink;pub use named_links::NamedLinks;pub use named_type_links::NamedTypeLinks;pub use named_types::NamedTypes;pub use named_types::NamedTypesDecorator;pub use parser::Parser;pub use permissions::AccessPolicy;pub use permissions::Forbidden;pub use permissions::LinksTokenTable;pub use permissions::PermissionAccess;pub use permissions::PermissionMarkers;pub use permissions::PermissionPolicy;pub use permissions::PermissionsDecorator;pub use persistent_transformations::make_triggers_database_filename;pub use persistent_transformations::PersistentTransformation;pub use persistent_transformations::PersistentTransformationDecorator;pub use persistent_transformations::PersistentTransformationKind;pub use persistent_transformations::PersistentTransformationQuery;pub use persistent_transformations::TriggerStore;pub use persistent_transformations::INTERNAL_NAME_PREFIX;pub use pinned_types::PinnedTypes;pub use pinned_types::PinnedTypesAccess;pub use pinned_types::PinnedTypesDecorator;pub use protocol::BinaryLinoProtocol;pub use protocol::LinksClient;pub use protocol::LinksServer;pub use protocol::LinoProtocol;pub use protocol::TextLinoProtocol;pub use query_address::QueryAddress;pub use query_options::QueryOptions;pub use query_processor::Changes;pub use query_processor::GenericQueryProcessor;pub use query_processor::QueryProcessor;pub use remap_links::AddressMap;pub use remap_links::AddressTable;pub use remap_links::OffsetAddressMap;pub use remap_links::RemapLinks;pub use storage::lock_file_path;pub use storage::DoubletsStorage;pub use storage::FileLock;pub use storage::FileMappedUnitStore;pub use storage::FileMappedValue;pub use storage::LinksStorage;pub use storage::LinksStorageRef;pub use storage::LockMode;pub use storage::MappedFlush;pub use storage::NamedLinksStorage;pub use storage::PersistentFileMapped;pub use storage::ResolvedFileMappedUnitStore;pub use storage::StorageRevision;pub use transactions::import_links_journal;pub use transactions::is_links_journal;pub use transactions::make_legacy_transitions_filename;pub use transactions::make_transitions_log_filename;pub use transactions::open_transitions_journal;pub use transactions::CommitMode;pub use transactions::DoubletLink;pub use transactions::FileTransactionsDecorator;pub use transactions::FileTransitionLog;pub use transactions::GenericDoubletLink;pub use transactions::GenericTransactionsDecorator;pub use transactions::GenericTransition;pub use transactions::LogRetentionPolicy;pub use transactions::ReplaceableTransitionLogStore;pub use transactions::RowUndoPolicy;pub use transactions::TransactionHandle;pub use transactions::TransactionsDecorator;pub use transactions::Transition;pub use transactions::TransitionKind;pub use transactions::TransitionLogStore;pub use triplets::import_triplets_lino;pub use triplets::process_triplets_query;pub use triplets::triplets_to_lino;pub use triplets::DoubletRole;pub use triplets::Triplet;pub use triplets::TripletChange;pub use triplets::TripletMarkers;pub use triplets::TripletQuery;pub use triplets::Triplets;pub use triplets::TripletsOverDoublets;pub use triplets::NOTHING_MARKER_NAME;pub use triplets::PAIR_MARKER_NAME;pub use types::ensure_point;pub use types::TypeMarkers;pub use types::Types;pub use types::TypesDecorator;pub use types::EXTENDS_NAME;pub use types::ROOT_TYPE_NAME;pub use undoable_links::LinkChange;pub use undoable_links::LinksUndoLog;pub use undoable_links::UndoableLinksDecorator;pub use unicode_string_storage::UnicodeStringStorage;pub use union_links::UnionLinks;pub use union_links::UnionMember;pub use version_control::BranchInfo;pub use version_control::FileVersionControlDecorator;pub use version_control::GenericVersionControlDecorator;pub use version_control::VersionControlDecorator;pub use version_control::DEFAULT_BRANCH_NAME;pub use doublets;
Modules§
- cache_
links - A links store used as a cache: links can expire, and the store can be kept
to a number of links by evicting the ones used least recently. It has the API
of any other store, so only a store that selects it pays for it. See
docs/ENGINE-CACHE.md. The C# twin isCacheLinksDecorator<TLinkAddress>, the JavaScript oneCacheLinksof@link-foundation/link-cli-client. - changes_
simplifier - Simplifies the raw changes of one query to the net change of every link.
- cli
- Command-line argument parsing for the
clinkbinary. - decorators
- The upstream
doubletsdecorator layer, re-exported so downstream crates can stack decorators onto aDoubletsStoragethroughDoubletsStorage::map_storewithout depending ondoubletsdirectly (and without risking a version mismatch). Decorators that add policy and transactions to anyDoubletsstore. - engine
- Optional staged links engine: concurrency, immutable history, and a
replaceable commit log. See
docs/ENGINE-STRATEGIES.mdfor costs and limits. - error
- Error types for link operations
- external_
ids - The ids other systems give our links, stored as links (issue #149): a UUID of a service, an ObjectId of a document database, a URL, bound to a link of ours and back, so the code that talks to the other system never keeps a table of its own.
- graphql
- A Hasura-compatible GraphQL server for the Deep standard (issue #153), so
that
DeepClientand deepcase connect toclink --serve --graphql. - hybrid_
reference Platform.Data.Hybrid<uint>-compatible reference encoding.- indexed_
links - Optional secondary-index decorator for the in-memory links map.
- link
- Link - A doublet (source, target) pair with an index
- link_
reference_ validator - Checking that every link a query refers to exists, and creating the ones that do not when the caller asked for that.
- link_
storage - LinkStorage - Persistent storage for links
- link_
storage_ doublets - Bridge between the CLI’s
LinkStorageand the upstreamdoubletstraits. - lino_
database_ input - LiNo database import helpers.
- lino_
link - LinoLink - A parsed LiNo link structure
- named_
links - Link-backed names facade matching the C#
NamedLinks<uint>role. - named_
type_ links NamedTypeLinks, the storage interface every layer of the CLI is written against, and its implementations for the plain store and for each decorator.- named_
types - Named type decorator for Rust link storage.
- parser
- LiNo Parser - Parses LiNo notation into LinoLink structures.
- permissions
- An optional permission layer with permissions stored in links (issue #149),
the Rust port of
createPolicyandwithPermissionsof@link-foundation/ui-links; the C# counterparts arePermissionPolicy<TLinkAddress>andPermissionsDecorator<TLinkAddress>. - persistent_
transformations - Persistent transformation triggers.
- pinned_
types - Pinned type allocation compatible with the C#
PinnedTypeshelper. - protocol
- LiNo substitution operations over TCP/IP (issue #105).
- query_
address - Addresses understood by the shared query and named-store interfaces.
- query_
options - The options one query is processed with.
- query_
processor - QueryProcessor - Handles LiNo query parsing and execution
- query_
processor_ substitution - The substitution half of
GenericQueryProcessor: turning a matched restriction plus a substitution pattern into the links to write. - query_
types - The intermediate shapes a query passes through: the
Patterna restriction or substitution parses into, and theResolvedLinka pattern becomes once its variables are bound. - remap_
links - A links network under other addresses (issue #149): every address that goes down is mapped to the network’s own, and every address that comes up is mapped back, so the code above never thinks about remapping.
- sequences
- Rust ports of the
Data.Doublets.Sequencesabstractions used by C#. - storage
- Reusable storage layer: traits, a doublets-backed implementation and advisory locking helpers.
- store_
lock - Store locking for
clinkinvocations (issue #194). - transactions
- Optional transactions layer for the Rust link-cli.
- triplets
- Triplets
(index: type from to)stored in doublets, with an associative API over anyNamedTypeLinks(issue #151). - types
- A type hierarchy with recursive sub-typing and multiple inheritance, kept in the links themselves (issue #148).
- undoable_
links - Writes kept to be undone (issue #149):
LinksUndoLogand theUndoableLinksDecoratorthat fills it, so a request that fails can be undone whole. The C# counterparts areLinksUndoLog<TLinkAddress>andUndoableLinksDecorator<TLinkAddress>. - unicode_
string_ storage - Unicode string and name storage backed by doublet links.
- union_
links - Many links networks seen as one (issue #149): the joining layer of a client’s links with a server’s, of a cache with its source, of the networks of several services.
- version_
control - Optional version-control layer for the Rust link-cli.
Structs§
- Binary
Lino Options - Optional features of the binary LiNo protocol.