Skip to main content

Crate link_cli

Crate link_cli 

Source
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 structure
  • error - Error types for link operations
  • lino_link - LiNo link representation
  • parser - LiNo notation parser
  • link_storage - Persistent link storage
  • storage - Reusable storage traits and the doublets-backed store
  • changes_simplifier - Changes simplification
  • query_processor - LiNo query processing
  • query_types - Patterns and resolved links, the shapes a query passes through
  • link_reference_validator - Checking, and optionally creating, referenced links
  • named_type_links - The storage interface every layer is written against
  • named_types, pinned_types - Named and pinned type decorators
  • persistent_transformations - Persistent transformation triggers
  • permissions - An optional permission layer with rules stored in links
  • undoable_links - Writes kept to be undone, so a failed request leaves nothing
  • types - A type hierarchy with sub-types and multiple inheritance
  • triplets - Triplets (index: type from to) stored in doublets, with substitution and LiNo
  • transactions, version_control - Reversible transitions, branches and tags
  • union_links - Many networks seen as one, the first member shadowing the rest
  • cache_links - A store as a cache: links that expire and bounded capacity
  • remap_links - A network under other addresses: an offset or a table
  • external_ids - The ids of other systems (UUIDs, URLs) bound to links
  • graphql - A Hasura-compatible GraphQL server for the Deep standard
  • cli - 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::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_storage::LinkStorage;
pub use lino_database_input::import_lino_file;
pub use lino_database_input::import_lino_text;
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 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::make_legacy_transitions_filename;
pub use transactions::make_transitions_log_filename;
pub use transactions::open_transitions_journal;
pub use transactions::CommitMode;
pub use transactions::FileTransactionsDecorator;
pub use transactions::FileTransitionLog;
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::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 is CacheLinksDecorator<TLinkAddress>, the JavaScript one CacheLinks of @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 clink binary.
decorators
The upstream doublets decorator layer, re-exported so downstream crates can stack decorators onto a DoubletsStorage through DoubletsStorage::map_store without depending on doublets directly (and without risking a version mismatch). Decorators that add policy and transactions to any Doublets store.
engine
Optional staged links engine: concurrency, immutable history, and a replaceable commit log. See docs/ENGINE-STRATEGIES.md for 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 DeepClient and deepcase connect to clink --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 LinkStorage and the upstream doublets traits.
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 createPolicy and withPermissions of @link-foundation/ui-links; the C# counterparts are PermissionPolicy<TLinkAddress> and PermissionsDecorator<TLinkAddress>.
persistent_transformations
Persistent transformation triggers.
pinned_types
Pinned type allocation compatible with the C# PinnedTypes helper.
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 Pattern a restriction or substitution parses into, and the ResolvedLink a 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.Sequences abstractions used by C#.
storage
Reusable storage layer: traits, a doublets-backed implementation and advisory locking helpers.
store_lock
Store locking for clink invocations (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 any NamedTypeLinks (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): LinksUndoLog and the UndoableLinksDecorator that fills it, so a request that fails can be undone whole. The C# counterparts are LinksUndoLog<TLinkAddress> and UndoableLinksDecorator<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§

BinaryLinoOptions
Optional features of the binary LiNo protocol.