OXY API 1.0
OXY API Library Documentation
Loading...
Searching...
No Matches
oxy Namespace Reference

This root namespace contains the common types and operations for the OXY-API library. More...

Namespaces

namespace  api
 This namespace contains the high-level definitions and operations for the OXY-API library.
namespace  core
 This namespace contains core types and operations for the OXY-API library.
namespace  filter
 This namespace contains function objects and operations related to filter management.

Classes

struct  attach_fn
 Function object to attach a SQLite database to an existing connection. More...
struct  blob_t
 In-memory representation of a blob object. More...
 In-memory representation of a link betwin an oid and a category. More...
struct  category_t
 In-memory representation of a category. More...
struct  commit_t
 In-memory representation of a commit. More...
struct  connect_fn
 Function object to establish a connection to a SQLite database. More...
struct  connection_t
 Representation of a sqlite's connection. More...
struct  contents_t
 In-memory representation of a contents. More...
struct  context_t
 Representation of a context. More...
struct  copy_fn
 Function object to copy a table or filtered data from one SQLite database to another. More...
struct  count_fn
 Function object to count entries in a schema of a SQLite database. More...
struct  create_filter_fn
 Function object to create a filter in a SQLite database. More...
struct  detach_fn
 Function object to detach a SQLite database from an existing connection. More...
struct  entry_t
 Representation of an entry of an index. More...
struct  enum_file_fn
 Function object to enumerate files in a directory. More...
struct  exec_fn
 Function object to execute a SQL statement on a SQLite database connection. More...
struct  expandEnvVar_fn
 Function object to expand environment variables in strings and paths. More...
struct  format_message_fn
 Functor to format messages based on message IDs. More...
struct  get_envvar_fn
 Function object to get the value of an environment variable. More...
struct  get_oid_fn
 Get the identifier of an Oxy object. More...
struct  get_timestamp_fn
 Function object to retrieve the current timestamp as a string. More...
struct  hash_fn
 Functor to compute SHA-1 hashes for various input types. More...
struct  index_t
 In-memory representation of a index object. More...
struct  make_balanced_filters_fn
 Function object to create balanced word filters based on the maximum number of filters. More...
struct  make_dynamic_filters_fn
 Function object to dynamically create word filters based on the maximum number of inputs per filter. More...
struct  make_object_fn
 Function object to generate an object containing the given contents and type. More...
struct  make_tmpfile_fn
 Function object to create a unique temporary file path with a specified extension. More...
struct  manifest_t
 In-memory representation of a manifest. More...
 In-memory representation of a metadata. More...
struct  mime_t
 Representation of a MIME code. More...
struct  object_t
 Representation of an OXY object. More...
struct  oid_t
 Unique identity of any object. More...
struct  PathRemover
 Custom deleter for std::filesystem::path that removes the file or directory when the unique_ptr goes out of scope. More...
struct  push_fn
 Function object to push items to a filter in a SQLite database. More...
struct  push_optional_f
 Functor to push an optional value into a JSON object. More...
struct  record_t
 In-memory representation of a record. More...
struct  scope_exit
 A utility for executing a function upon exiting a scope. More...
struct  set_envVar_fn
 Function object to set the value of an environment variable. More...
struct  set_value_f
 Functor to set a value in a JSON object. More...
struct  sha1sum_fn
 Function object to compute SHA-1 checksums of files and streams. More...
struct  signature_t
 In-memory representation of a signature. More...
struct  stream_t
 In-memory representation of a stream. More...
 In-memory representation of a link betwin an oid and a tag. More...
struct  tag_t
 In-memory representation of a tag. More...
struct  tags_t
 In-memory representation of a collection of tag. More...
struct  timestamp_t
 In-memory representation of the timestamp. More...
struct  update_fn
 Function object to update a table in a SQLite database. More...
struct  win32_error_code
 A wrapper for Win32 error codes to facilitate conversion to std::error_code. More...

Typedefs

using connection_ptr = std::shared_ptr<connection_t>
 Shared pointer type for managing connection_t instances.
using database_t = SQLite::Database
using hash_t = std::string
 Type alias for the SHA-1 hash representation.
using local_time_point = std::chrono::local_time<std::chrono::duration<std::int64_t, std::micro>>
 Type aliases for different time point representations.
template<typename T>
using maybe = std::optional<T>
 Type alias for representing optional values using std::optional.
using path_t = std::filesystem::path
 Alias for the std::filesystem::path type used in the oxy library.
using paths_t = std::vector<path_t>
 Alias for a vector of path_t used in the oxy library.
using reference_t = references::value_type
 In-memory representation of a reference.
using references = std::map<std::string, std::string>
 In-memory representation of a collection of references.
using remote_t = remotes_t::value_type
 In-memory representation of a remote object.
using remotes_t = std::map<std::string, std::string>
 In-memory representation of a collection of remote objects.
template<class T>
using result = std::expected<T, std::error_code>
 A template alias for a result type that can either hold a value of type T or an error code.
using result_type = std::map<std::string, std::vector<std::string>>
 A type alias for a map that associates strings with vectors of strings.
using time_point = std::chrono::system_clock::time_point
using unique_path = std::unique_ptr<std::filesystem::path, PathRemover>
 Alias for unique_ptr with PathRemover.
using utc_time_point = std::chrono::utc_clock::time_point

Enumerations

enum class  eType { any = 0 , commit = 1 , index = 2 , blob = 3 }
 Basic type of any object. More...

Functions

template<typename T>
auto dumps (T const &item) -> std::string
 Helper function to serialize an object of type T to a JSON string.
constexpr auto get_author (const commit_t &item)
 Helper to get the author of an commit.
auto & get_db (connection_ptr const &conn)
auto get_long_timestamp () -> std::string
 Gets the current UTC timestamp as a string in ISO 8601 format with microseconds (YYYY-MM-DDTHH:MM:SS.ssssss).
constexpr auto get_name (const signature_t &item)
 Helper to get the name of a signature.
template<typename T>
auto get_object (json::value const &jv, json::string_view key)
 Helper function to get a value of type T from a JSON object by key.
constexpr auto get_parents (const commit_t &item)
 Helper to get the parents of an commit.
auto get_short_timestamp () -> std::string
 Gets the current UTC timestamp as a string in ISO 8601 format (YYYY-MM-DDTHH:MM:SS).
constexpr auto get_tree (const commit_t &item)
 Gets the index id of a commit.
constexpr auto get_type (object_t const &item)
 Helper to get the type of an object.
constexpr auto get_url (const reference_t &item)
 Gets the URL of an Oxy reference.
constexpr auto get_value (const blob_t &item)
 Gets the value of a blob.
constexpr auto get_value (const oid_t &item)
 Helper toget the id of a index an Oxy object.
constexpr auto get_value (const timestamp_t &item)
 Helper to get the value of a timestamp.
template<typename T>
auto get_value (json::value const &jv, json::string_view key) -> std::optional< T >
 Helper function to get a value of type T from a JSON object by key.
constexpr auto get_when (const signature_t &item)
 Helper to get the when of a signature.
auto is_uuid (std::string const &id)
 Checks whether a string is a valid UUID.
template<typename T>
constexpr auto just (T x) -> maybe< T >
 Helper function to create a maybe instance containing a value.
template<typename T>
auto loads (std::string const &stream) -> T
 Helper function to deserialize a JSON string to an object of type T.
std::error_code make_error_code (win32_error_code const &we)
 Creates a std::error_code from a win32_error_code object.
std::string make_nil_uuid ()
 Creates a nil (all-zeros) UUID and returns it as a string.
unique_path make_unique_path (const std::filesystem::path &path)
 Helper function to make a unique_path.
std::string make_uuid ()
 Generates a random UUID and returns it as a string.
std::error_code make_win32_error_code ()
 Create an error_code from the last Windows error.
std::error_code make_win32_error_code (DWORD e)
 Create an error_code from a Windows error code.
std::error_code make_winsock_error_code ()
 Create an error_code from the last Winsock error.
void merge_json (boost::json::value &dst, const boost::json::value &src, bool array_append=false)
 Helper function to merge two JSON values recursively.
std::string normalize_iso8601 (const std::string &datetime)
 Normalizes an ISO 8601 datetime string by replacing the 'T' separator with a space.
constexpr auto nothing ()
 Helper function to create an empty maybe instance.
std::chrono::sys_time< std::chrono::milliseconds > parse_iso8601 (const std::string &s)
 Parses an ISO 8601 formatted date-time string into a system time point with millisecond precision.
template<class Provider, class Hash, class Flavor>
void tag_invoke (boost::hash2::hash_append_tag const &, Provider const &, Hash &h, Flavor const &f, object_t const *v)
 Customization point for hashing a object_t using Boost.Hash2.
template<class Provider, class Hash, class Flavor>
void tag_invoke (boost::hash2::hash_append_tag const &, Provider const &, Hash &h, Flavor const &f, oid_t const *v)
 Customization point for hashing a oid_t using Boost.Hash2.
template<class Provider, class Hash, class Flavor>
void tag_invoke (boost::hash2::hash_append_tag const &, Provider const &, Hash &h, Flavor const &f, timestamp_t const *v)
 Customization point for hashing a timestamp_t object using Boost.Hash2.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, category_t const &item) -> void
 Converts a category_t object to its string representation.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, commit_t const &item) -> void
 Converts a commit_t object to its string representation.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, contents_t const &item) -> void
 Overload customization point for serializing a contents_t object into a JSON type.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, entry_t const &item) -> void
 Converts a entry_t object to its string representation.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, eType const &item) -> void
 Overload customization point for serializing an eType object into a JSON type.
void tag_invoke (boost::json::value_from_tag, boost::json::value &jv, manifest_t const &item)
 Converts a manifest object to a Boost.JSON value using tag_invoke customization point.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, metadata_t const &item) -> void
 Converts a metadata_t object to its string representation.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, mime_t const &item) -> void
 Converts a mime_t object to its string representation.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, object_t const &item) -> void
 Overload customization point for serializing an object_t instance into a JSON type.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, oid_t const &item) -> void
 Overload customization point for serializing a oid_t object into a JSON type.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, record_t const &item) -> void
 Converts a record_t object to its string representation.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, signature_t const &item) -> void
 Converts a contents_t object to its string representation.
void tag_invoke (boost::json::value_from_tag, boost::json::value &jv, stream_t const &item)
 Converts a stream object to a Boost.JSON value using tag_invoke customization point.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, tag_t const &item) -> void
 Converts a tag_t object to its string representation.
auto tag_invoke (boost::json::value_from_tag, boost::json::value &jv, timestamp_t const &item) -> void
 Overload customization point for serializing a timestamp_t object into a JSON type.
auto tag_invoke (const boost::json::value_to_tag< category_t > &, boost::json::value const &jv) -> category_t
 Converts a Boost.JSON value to a category_t object by extracting and parsing the JSON string value.
auto tag_invoke (const boost::json::value_to_tag< commit_t > &, boost::json::value const &jv) -> commit_t
 Converts a Boost.JSON value to a commit_t object by extracting and parsing the JSON string value.
auto tag_invoke (const boost::json::value_to_tag< contents_t > &, boost::json::value const &jv) -> contents_t
 Converts a Boost.JSON value to a contents_t object by extracting and parsing the JSON string value.
auto tag_invoke (const boost::json::value_to_tag< entry_t > &, boost::json::value const &jv) -> entry_t
 Converts a Boost.JSON value to a entry_t object by extracting and parsing the JSON string value.
auto tag_invoke (const boost::json::value_to_tag< eType > &, boost::json::value const &jv) -> eType
 Converts a JSON value to an eType object by extracting its string representation.
manifest_t tag_invoke (const boost::json::value_to_tag< manifest_t > &, boost::json::value const &jv)
 Converts a Boost.JSON value to a manifest_t object using tag_invoke customization point.
auto tag_invoke (const boost::json::value_to_tag< metadata_t > &, boost::json::value const &jv) -> metadata_t
 Converts a Boost.JSON value to a metadata_t object by extracting and parsing the JSON string value.
auto tag_invoke (const boost::json::value_to_tag< mime_t > &, boost::json::value const &jv) -> mime_t
 Converts a Boost.JSON value to a mime_t object by extracting and parsing the JSON string value.
auto tag_invoke (const boost::json::value_to_tag< object_t > &, boost::json::value const &jv) -> object_t
 Converts a JSON value to an object_t instance by extracting its id and type\ members.
auto tag_invoke (const boost::json::value_to_tag< record_t > &, boost::json::value const &jv) -> record_t
 Converts a Boost.JSON value to a record_t object by extracting and parsing the JSON string value.
auto tag_invoke (const boost::json::value_to_tag< signature_t > &, boost::json::value const &jv) -> signature_t
 Converts a Boost.JSON value to a signature_t object by extracting and parsing the JSON string value.
stream_t tag_invoke (const boost::json::value_to_tag< stream_t > &, boost::json::value const &jv)
 Converts a Boost.JSON value to a stream_t object using tag_invoke customization point.
auto tag_invoke (const boost::json::value_to_tag< tag_t > &, boost::json::value const &jv) -> tag_t
 Converts a Boost.JSON value to a tag_t object by extracting and parsing the JSON string value.
auto tag_invoke (const boost::json::value_to_tag< timestamp_t > &, boost::json::value const &jv) -> timestamp_t
 Converts a Boost.JSON value to a timestamp_t object by extracting and parsing the JSON string value.
auto tag_invoke (const json::value_to_tag< oid_t > &, json::value const &jv) -> oid_t
 Converts a JSON value to an oid_t object by extracting its string representation.
auto to_long_string (time_point const &aclock) -> std::string
 Converts a system clock time point to a string representation in ISO 8601 format with microseconds.
template<typename T>
auto & to_object (T &value, json::value const &jv, json::string_view key)
 Helper function to set a value of type T in a JSON object by key.
auto to_string (commit_t const &v)
 Converts a commit_t object to its string representation.
auto to_string (entry_t const &v)
 Converts a entry_t object to its string representation.
auto to_string (eType const &v)
 Converts an enumeration value to its string representation.
auto to_string (local_time_point const &aclock) -> std::string
 Converts a local time point to a string representation in ISO 8601 format.
auto to_string (object_t const &v)
 Converts an object_t to its string representation.
auto to_string (oid_t const &v)
 Converts a oid_t object to its string representation.
auto to_string (record_t const &v)
 Converts a record_t object to its string representation.
auto to_string (signature_t const &v)
 Converts a signature_t object to its string representation.
auto to_string (time_point const &aclock) -> std::string
 Converts a system clock time point to a string representation in ISO 8601 format.
auto to_string (timestamp_t const &v)
 Converts a timestamp_t object to its string representation.
auto to_utc_long_string (utc_time_point const &aclock) -> std::string
 Converts a UTC clock time point to a string representation in ISO 8601 format with microseconds.
auto to_utc_string (time_point const &aclock) -> std::string
 Converts a UTC clock time point to a string representation in ISO 8601 format.
auto to_utc_string (utc_time_point const &aclock) -> std::string
 Converts a UTC clock time point to a string representation in ISO 8601 format with microseconds.

Variables

constexpr attach_fn attach
 A constexpr instance of the attach_fn function object for use in functional programming.
constexpr const char CONFIG [] = "CONFIG"
constexpr connect_fn connect
 A constexpr instance of the connect_fn function object for use in functional programming.
constexpr const char CONTAINERS [] = "containers"
constexpr copy_fn copy
 A constexpr instance of the copy_fn function object for use in functional programming.
constexpr count_fn count
 A constexpr instance of the count_fn function object for use in functional programming.
constexpr create_filter_fn create_filter
 A constexpr instance of the create_filter_fn function object for use in functional programming.
constexpr detach_fn detach
 A constexpr instance of the detach_fn function object for use in functional programming.
constexpr enum_file_fn enum_file
 A constexpr instance of the enum_file_fn function object for use in functional programming.
constexpr exec_fn exec
 A constexpr instance of the exec_fn function object for use in functional programming.
constexpr expandEnvVar_fn expandEnvVar
 A constexpr instance of the expandEnvVar_fn function object for use in functional programming.
constexpr format_message_fn format_message
 A constexpr instance of the format_message_functor function object for use in functional programming.
constexpr get_oid_fn get_oid
 Get the identifier of an Oxy object.
constexpr get_timestamp_fn get_timestamp
 A constexpr instance of the get_timestamp_fn function object for use in functional programming.
constexpr get_envvar_fn getEnvVar
 A constexpr instance of the get_envvar_fn function object for use in functional programming.
constexpr hash_fn hash
 A constexpr instance of the hash_fn function object for use in functional programming.
constexpr const char HEADS [] = "heads"
constexpr const char ICON [] = "ICON"
constexpr auto is_blob = [](const object_t &obj) { return obj.type() == eType::blob; }
 Helper to check if the object belongs to the blob type.
constexpr auto is_commit = [](const object_t &obj) { return obj.type() == eType::commit; }
 Helper to check if the object belongs to the commit type.
constexpr auto is_tree = [](const object_t &obj) { return obj.type() == eType::index; }
 Helper to check if the object belongs to the index type.
constexpr const char MAIN [] = "heads:main"
constexpr make_balanced_filters_fn make_balanced_filters
 A constexpr instance of the make_balanced_filters_fn function object for use in functional programming.
constexpr make_dynamic_filters_fn make_dynamic_filters
 A constexpr instance of the make_dynamic_filters_fn function object for use in functional programming.
constexpr make_object_fn make_object
 A constexpr instance of the make_object_fn function object for use in functional programming.
constexpr make_tmpfile_fn make_tmpfile
 A constexpr instance of the make_tmpfile_fn function object for use in functional programming.
constexpr const char MANIFEST [] = "heads:manifest"
constexpr const char METADATA [] = "metadata"
constexpr const char PROPERTIES [] = "PROPERTIES"
constexpr push_fn push
 A constexpr instance of the push_fn function object for use in functional programming.
template<typename T>
constexpr auto push_optional = hof::pipable(push_optional_f{})
 A pipable adaptor for the push_optional_f functor, allowing for functional programming style.
constexpr const char REMOTES [] = "remotes"
template<typename T>
constexpr auto set_value = hof::pipable(set_value_f{})
 A pipable adaptor for the set_value_f functor, allowing for functional programming style.
constexpr set_envVar_fn setEnvVar
 A constexpr instance of the set_envVar_fn function object for use in functional programming.
constexpr sha1sum_fn sha1sum
 A constexpr instance of the sha1sum_fn function object for use in functional programming.
constexpr const char STREAMS [] = "streams"
constexpr const char TIMELINE [] = "timeline"
constexpr update_fn update
 A constexpr instance of the update_fn function object for use in functional programming.
const detail::win32_error_category win32_error_category {}
 A global instance of the Win32 error category for use with the error handling system.

Detailed Description

This root namespace contains the common types and operations for the OXY-API library.

The oxy namespace serves as the root namespace for the OXY-API library, encapsulating all fundamental types, structures, and operations related to the OXY system. It provides a cohesive and organized structure for the library's components.

Typedef Documentation

◆ reference_t

using oxy::reference_t = references::value_type

In-memory representation of a reference.

A reference is a single mapping between a URL and an oid, which can be used to track the location of an object in a remote repository. It is represented as a pair of strings, where the first element is the URL and the second element is the oid.

◆ references

using oxy::references = std::map<std::string, std::string>

In-memory representation of a collection of references.

A reference is a mapping between a URL and an oid, which can be used to track the location of an object in a remote repository. The references collection is a map of URL-oid pairs, which can be used to manage and organize the references in the OXY system.

Enumeration Type Documentation

◆ eType

enum class oxy::eType
strong

Basic type of any object.

The type is an enumeration of the different types of objects in the OXY system, which can be commit, index, or blob. It is used to indicate the nature of the object and how it should be handled in the system.

Enumerator
any 

Unknown type.

commit 

Object of commit type.

index 

Object of index type.

blob 

Object of blob type.

Function Documentation

◆ dumps()

template<typename T>
auto oxy::dumps ( T const & item) -> std::string
inline

Helper function to serialize an object of type T to a JSON string.

Parameters
item- The object to serialize.
Returns
A string containing the serialized JSON representation of the object.

Referenced by oxy::core::make_stream_f::operator()(), oxy::core::make_stream_f::operator()(), to_string(), to_string(), to_string(), to_string(), and to_string().

◆ get_author()

auto oxy::get_author ( const commit_t & item)
constexpr

Helper to get the author of an commit.

Parameters
item- define the commit.
Returns
the author of the commit

◆ get_long_timestamp()

auto oxy::get_long_timestamp ( ) -> std::string
inline

Gets the current UTC timestamp as a string in ISO 8601 format with microseconds (YYYY-MM-DDTHH:MM:SS.ssssss).

Returns
A string representing the current UTC timestamp in ISO 8601 format with microseconds.

References to_utc_long_string().

◆ get_name()

auto oxy::get_name ( const signature_t & item)
constexpr

Helper to get the name of a signature.

Parameters
index- define the target index.
Returns
the object

Referenced by tag_invoke().

◆ get_object()

template<typename T>
auto oxy::get_object ( json::value const & jv,
json::string_view key )
inline

Helper function to get a value of type T from a JSON object by key.

Parameters
jv- The JSON value to search in.
key- The key to look for in the JSON object.
Returns
The value of type T if the key exists and is not null, or a default-constructed T if the key does not exist or is null.

References get_value().

◆ get_parents()

auto oxy::get_parents ( const commit_t & item)
constexpr

Helper to get the parents of an commit.

Parameters
item- define the commit.
Returns
the parents of the commit

◆ get_short_timestamp()

auto oxy::get_short_timestamp ( ) -> std::string
inline

Gets the current UTC timestamp as a string in ISO 8601 format (YYYY-MM-DDTHH:MM:SS).

Returns
A string representing the current UTC timestamp in ISO 8601 format.

References to_utc_string().

◆ get_tree()

auto oxy::get_tree ( const commit_t & item)
constexpr

Gets the index id of a commit.

Parameters
item- define the target commit.
Returns
the index id.

◆ get_type()

auto oxy::get_type ( object_t const & item)
constexpr

Helper to get the type of an object.

Parameters
object- Define the target object.
Returns
The identifier

Referenced by tag_invoke().

◆ get_url()

auto oxy::get_url ( const reference_t & item)
constexpr

Gets the URL of an Oxy reference.

Parameters
item- define the reference.
Returns
the URL of the reference

◆ get_value() [1/4]

auto oxy::get_value ( const blob_t & item)
constexpr

Gets the value of a blob.

Parameters
item- define the target blob.
Returns
the value

◆ get_value() [2/4]

auto oxy::get_value ( const oid_t & item)
constexpr

Helper toget the id of a index an Oxy object.

Parameters
item- define the target object.
Returns
identity of the object.

◆ get_value() [3/4]

auto oxy::get_value ( const timestamp_t & item)
constexpr

Helper to get the value of a timestamp.

Parameters
item- define the timestamp.
Returns
value of the when.

◆ get_value() [4/4]

template<typename T>
auto oxy::get_value ( json::value const & jv,
json::string_view key ) -> std::optional< T >
inline

Helper function to get a value of type T from a JSON object by key.

Parameters
jv- The JSON value to search in.
key- The key to look for in the JSON object.
Returns
An optional containing the value of type T if the key exists and is not null, or std::nullopt if the key does not exist or is null.

Referenced by get_object(), oxy::core::blob::make_object_fn::operator()(), oxy::api::tag_invoke(), oxy::api::tag_invoke(), tag_invoke(), tag_invoke(), tag_invoke(), tag_invoke(), tag_invoke(), tag_invoke(), tag_invoke(), tag_invoke(), and tag_invoke().

◆ get_when()

auto oxy::get_when ( const signature_t & item)
constexpr

Helper to get the when of a signature.

Parameters
index- define the target index.
Returns
the entries

Referenced by tag_invoke().

◆ is_uuid()

auto oxy::is_uuid ( std::string const & id)
inline

Checks whether a string is a valid UUID.

Parameters
idThe string to validate as a UUID.
Returns
True if the string matches the UUID format (with or without dashes), false otherwise.

◆ just()

template<typename T>
auto oxy::just ( T x) -> maybe< T >
constexpr

Helper function to create a maybe instance containing a value.

Parameters
x- The value to wrap in a maybe.
Returns
A maybe instance containing the provided value.

◆ loads()

template<typename T>
auto oxy::loads ( std::string const & stream) -> T
inline

Helper function to deserialize a JSON string to an object of type T.

Parameters
stream- The JSON string to deserialize.
Returns
An object of type T constructed from the deserialized JSON data.

◆ make_error_code()

std::error_code oxy::make_error_code ( win32_error_code const & we)
inline

Creates a std::error_code from a win32_error_code object.

This function overloads the global make_error_code() free function, and allows the conversion of a win32_error_code object into a std::error_code, associating it with the win32_error_category. It enables seamless integration of Win32 error codes with the standard C++ error handling system. It will be found via ADL by the compiler if needed.

Parameters
weThe win32_error_code object to convert into a std::error_code.
Returns
A std::error_code representing the Windows error with the win32_error_category.

References win32_error_category.

Referenced by make_win32_error_code().

◆ make_nil_uuid()

std::string oxy::make_nil_uuid ( )
inline

Creates a nil (all-zeros) UUID and returns it as a string.

Returns
A string representation of the nil UUID (e.g., "00000000-0000-0000-0000-000000000000").

References to_string().

◆ merge_json()

void oxy::merge_json ( boost::json::value & dst,
const boost::json::value & src,
bool array_append = false )
inline

Helper function to merge two JSON values recursively.

This function merges the source JSON value into the destination JSON value recursively.

Parameters
dst- The destination JSON value to merge into.
src- The source JSON value to merge from.
array_append- A boolean flag indicating whether to append arrays (true) or replace arrays (false) when merging. Default is false.

References merge_json().

Referenced by merge_json().

◆ normalize_iso8601()

std::string oxy::normalize_iso8601 ( const std::string & datetime)
inline

Normalizes an ISO 8601 datetime string by replacing the 'T' separator with a space.

Parameters
datetimeThe ISO 8601 datetime string to normalize.
Returns
A normalized datetime string with the 'T' separator replaced by a space, or the original string if no 'T' is found.

Referenced by parse_iso8601().

◆ parse_iso8601()

std::chrono::sys_time< std::chrono::milliseconds > oxy::parse_iso8601 ( const std::string & s)
inline

Parses an ISO 8601 formatted date-time string into a system time point with millisecond precision.

Parameters
sThe ISO 8601 formatted string to parse (e.g., "2023-12-25T10:30:45.123Z").
Returns
A system time point representing the parsed date and time with millisecond precision. Returns an unspecified time point if parsing fails.

References normalize_iso8601().

◆ tag_invoke() [1/33]

template<class Provider, class Hash, class Flavor>
void oxy::tag_invoke ( boost::hash2::hash_append_tag const & ,
Provider const & ,
Hash & h,
Flavor const & f,
object_t const * v )

Customization point for hashing a object_t using Boost.Hash2.

This function provides a specialization of the tag_invoke function for the boost::hash2::hash_append_tag tag, allowing the object_t type to be hashed using the Boost Hash2 library. It appends the values of the oid and type members of the object_t object to the provided hash object.

Template Parameters
ProviderThe type of the provider (not used in this implementation).
HashThe type of the hash object to which the object_t values will be appended.
FlavorThe type of the flavor (not used in this implementation).
Parameters
vPointer to the object_t object to be hashed.
hReference to the hash object to which the object_t values will be appended.
fReference to the flavor (not used in this implementation).

◆ tag_invoke() [2/33]

template<class Provider, class Hash, class Flavor>
void oxy::tag_invoke ( boost::hash2::hash_append_tag const & ,
Provider const & ,
Hash & h,
Flavor const & f,
oid_t const * v )

Customization point for hashing a oid_t using Boost.Hash2.

This function provides a specialization of the tag_invoke function for the boost::hash2::hash_append_tag tag, allowing the oid_t type to be hashed using the Boost Hash2 library. It appends the value of the oid_t object to the provided hash object.

Template Parameters
ProviderThe type of the provider (not used in this implementation).
HashThe type of the hash object to which the oid_t value will be appended.
FlavorThe type of the flavor (not used in this implementation).
Parameters
vPointer to the oid_t object to be hashed.
hReference to the hash object to which the oid_t value will be appended.
fReference to the flavor (not used in this implementation).

◆ tag_invoke() [3/33]

template<class Provider, class Hash, class Flavor>
void oxy::tag_invoke ( boost::hash2::hash_append_tag const & ,
Provider const & ,
Hash & h,
Flavor const & f,
timestamp_t const * v )

Customization point for hashing a timestamp_t object using Boost.Hash2.

This function provides a specialization of the tag_invoke function for the boost::hash2::hash_append_tag tag, allowing the timestamp_t type to be hashed using the Boost Hash2 library. It appends the value of the timestamp_t object to the provided hash object.

Template Parameters
ProviderThe hash provider type.
HashThe hash algorithm type.
FlavorThe hash flavor type that controls hashing behavior.
Parameters
Providerobject for the hash algorithm (unused).
Providerobject for the hash algorithm (unused).
hThe hash object to append data to.
fThe flavor parameter controlling hash behavior.
vPointer to the timestamp_t object to be hashed.

◆ tag_invoke() [4/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
category_t const & item ) -> void
inline

Converts a category_t object to its string representation.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to serialize into
itemThe category_t item to serialize

◆ tag_invoke() [5/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
commit_t const & item ) -> void
inline

Converts a commit_t object to its string representation.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to serialize into
itemThe commit_t item to serialize

References set_value.

◆ tag_invoke() [6/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
contents_t const & item ) -> void
inline

Overload customization point for serializing a contents_t object into a JSON type.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe JSON value to serialize into
itemThe contents_t item to serialize

◆ tag_invoke() [7/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
entry_t const & item ) -> void
inline

Converts a entry_t object to its string representation.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to serialize into
itemThe entry_t item to serialize

References set_value.

◆ tag_invoke() [8/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
eType const & item ) -> void
inline

Overload customization point for serializing an eType object into a JSON type.

This function is called by Boost.JSON when serializing an eType object. It converts the eType value into a JSON string using magic_enum::enum_name and assigns it to the provided JSON value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe JSON value to serialize into
itemThe eType item to serialize

◆ tag_invoke() [9/33]

void oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
manifest_t const & item )
inline

Converts a manifest object to a Boost.JSON value using tag_invoke customization point.

Parameters
Tagtype used for tag_invoke dispatch (unnamed parameter).
jvThe JSON value object to populate with the manifest data.
itemThe manifest object to convert to JSON.

References set_value.

◆ tag_invoke() [10/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
metadata_t const & item ) -> void
inline

Converts a metadata_t object to its string representation.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to serialize into
itemThe metadata_t item to serialize

◆ tag_invoke() [11/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
mime_t const & item ) -> void
inline

Converts a mime_t object to its string representation.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to serialize into
itemThe mime_t item to serialize

◆ tag_invoke() [12/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
object_t const & item ) -> void
inline

Overload customization point for serializing an object_t instance into a JSON type.

This function is called by Boost.JSON when serializing an object_t instance. It converts the object_t's oid and type members into JSON key-value pairs and assigns them to the provided JSON value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe JSON value to serialize into
itemThe object_t item to serialize

References get_oid, get_type(), and set_value.

◆ tag_invoke() [13/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
oid_t const & item ) -> void
inline

Overload customization point for serializing a oid_t object into a JSON type.

This function is called by Boost.JSON when serializing a oid_t object. It converts the oid_t value into a JSON string and assigns it to the provided JSON value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe JSON value to serialize into
itemThe oid_t item to serialize

References get_value().

◆ tag_invoke() [14/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
record_t const & item ) -> void
inline

Converts a record_t object to its string representation.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to serialize into
itemThe record_t item to serialize

References set_value.

◆ tag_invoke() [15/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
signature_t const & item ) -> void
inline

Converts a contents_t object to its string representation.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to serialize into
itemThe signature_t item to serialize

References get_name(), get_when(), and set_value.

◆ tag_invoke() [16/33]

void oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
stream_t const & item )
inline

Converts a stream object to a Boost.JSON value using tag_invoke customization point.

Parameters
Tagtype used for tag_invoke dispatch (unnamed parameter).
jvThe JSON value object to populate with the stream data.
itemThe stream object to convert to JSON.

References set_value.

◆ tag_invoke() [17/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
tag_t const & item ) -> void
inline

Converts a tag_t object to its string representation.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to serialize into
itemThe tag_t item to serialize

◆ tag_invoke() [18/33]

auto oxy::tag_invoke ( boost::json::value_from_tag ,
boost::json::value & jv,
timestamp_t const & item ) -> void
inline

Overload customization point for serializing a timestamp_t object into a JSON type.

This function is called by Boost.JSON when serializing a timestamp_t object. It converts the timestamp_t value into a JSON string and assigns it to the provided JSON value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe JSON value to serialize into
itemThe timestamp_t item to serialize

References get_value().

◆ tag_invoke() [19/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< category_t > & ,
boost::json::value const & jv ) -> category_t
inline

Converts a Boost.JSON value to a category_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of category.
Returns
A category_t object constructed from the string value in the JSON.

◆ tag_invoke() [20/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< commit_t > & ,
boost::json::value const & jv ) -> commit_t
inline

Converts a Boost.JSON value to a commit_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of commit.
Returns
A commit_t object constructed from the string value in the JSON.

References get_value().

◆ tag_invoke() [21/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< contents_t > & ,
boost::json::value const & jv ) -> contents_t
inline

Converts a Boost.JSON value to a contents_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of contents.
Returns
A contents_t object constructed from the string value in the JSON.

◆ tag_invoke() [22/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< entry_t > & ,
boost::json::value const & jv ) -> entry_t
inline

Converts a Boost.JSON value to a entry_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of entry.
Returns
A entry_t object constructed from the string value in the JSON.

References get_value().

◆ tag_invoke() [23/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< eType > & ,
boost::json::value const & jv ) -> eType
inline

Converts a JSON value to an eType object by extracting its string representation.

This function is called by Boost.JSON when deserializing a JSON value into an eType object. It expects the JSON value to contain a string representation of an eType and constructs an eType object from that string using magic_enum::enum_cast. If the string does not correspond to a valid eType, it defaults to eType::any.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe JSON value to convert, expected to contain a string representation of an eType.
Returns
An eType object constructed from the string value contained in the JSON value, or eType::any if the string does not match any valid eType.

References any.

◆ tag_invoke() [24/33]

manifest_t oxy::tag_invoke ( const boost::json::value_to_tag< manifest_t > & ,
boost::json::value const & jv )
inline

Converts a Boost.JSON value to a manifest_t object using tag_invoke customization point.

Parameters
Tagtype used for tag_invoke dispatch to specify conversion to manifest_t.
jvThe JSON value to convert from.
Returns
A manifest_t object constructed from the JSON value's fields: name (required), category (optional, defaults to empty), and tags (optional, defaults to empty).

References get_value().

◆ tag_invoke() [25/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< metadata_t > & ,
boost::json::value const & jv ) -> metadata_t
inline

Converts a Boost.JSON value to a metadata_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of metadata.
Returns
A metadata_t object constructed from the string value in the JSON.

◆ tag_invoke() [26/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< mime_t > & ,
boost::json::value const & jv ) -> mime_t
inline

Converts a Boost.JSON value to a mime_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of mime.
Returns
A mime_t object constructed from the string value in the JSON.

◆ tag_invoke() [27/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< object_t > & ,
boost::json::value const & jv ) -> object_t
inline

Converts a JSON value to an object_t instance by extracting its id and type\ members.

This function is called by Boost.JSON when deserializing a JSON value into an object_t instance. It expects the JSON value to contain id and type keys, and constructs an object_t instance from those values. If the type key is missing, it defaults to eType::any.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe JSON value to convert, expected to contain id and type keys.
Returns
An object_t instance constructed from the id and type values contained in the JSON value, or with eType::any if the type key is missing.

References any, and get_value().

◆ tag_invoke() [28/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< record_t > & ,
boost::json::value const & jv ) -> record_t
inline

Converts a Boost.JSON value to a record_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of record.
Returns
A record_t object constructed from the string value in the JSON.

References get_value().

◆ tag_invoke() [29/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< signature_t > & ,
boost::json::value const & jv ) -> signature_t
inline

Converts a Boost.JSON value to a signature_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of signature.
Returns
A signature_t object constructed from the string value in the JSON.

References get_value().

◆ tag_invoke() [30/33]

stream_t oxy::tag_invoke ( const boost::json::value_to_tag< stream_t > & ,
boost::json::value const & jv )
inline

Converts a Boost.JSON value to a stream_t object using tag_invoke customization point.

Parameters
Tagtype used for tag_invoke dispatch to specify conversion to stream_t.
jvThe JSON value to convert from.
Returns
A stream_t object constructed from the JSON value's fields: name (required), mime (optional, defaults to empty), and tags (optional, defaults to empty).

References get_value().

◆ tag_invoke() [31/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< tag_t > & ,
boost::json::value const & jv ) -> tag_t
inline

Converts a Boost.JSON value to a tag_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of tag.
Returns
A tag_t object constructed from the string value in the JSON.

◆ tag_invoke() [32/33]

auto oxy::tag_invoke ( const boost::json::value_to_tag< timestamp_t > & ,
boost::json::value const & jv ) -> timestamp_t
inline

Converts a Boost.JSON value to a timestamp_t object by extracting and parsing the JSON string value.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe Boost.JSON value to convert, expected to contain a string representation of a timestamp.
Returns
A timestamp_t object constructed from the string value in the JSON.

◆ tag_invoke() [33/33]

auto oxy::tag_invoke ( const json::value_to_tag< oid_t > & ,
json::value const & jv ) -> oid_t
inline

Converts a JSON value to an oid_t object by extracting its string representation.

This function is called by Boost.JSON when deserializing a JSON value into an oid_t object. It expects the JSON value to contain a string representation of an OID and constructs an oid_t object from that string.

Parameters
Tagtype used for tag_invoke ADL (Argument-Dependent Lookup) customization point.
jvThe JSON value to convert, expected to contain a string representation of an OID.
Returns
An oid_t object constructed from the string value contained in the JSON value.

◆ to_long_string()

auto oxy::to_long_string ( time_point const & aclock) -> std::string
inline

Converts a system clock time point to a string representation in ISO 8601 format with microseconds.

Parameters
aclockThe system clock time point to convert.
Returns
A string representing the system clock time point in ISO 8601 format with microseconds

References to_utc_long_string().

◆ to_object()

template<typename T>
auto & oxy::to_object ( T & value,
json::value const & jv,
json::string_view key )
inline

Helper function to set a value of type T in a JSON object by key.

Parameters
value- The value to set in the JSON object.
jv- The JSON value to modify.
key- The key to set in the JSON object.
Returns
A reference to the modified value.

◆ to_string() [1/10]

auto oxy::to_string ( commit_t const & v)
inline

Converts a commit_t object to its string representation.

Parameters
vThe commit_t object to convert.
Returns
A string representation of the commit_t object.

References dumps().

◆ to_string() [2/10]

auto oxy::to_string ( entry_t const & v)
inline

Converts a entry_t object to its string representation.

Parameters
vThe entry_t object to convert.
Returns
A string representation of the entry_t object.

References dumps().

◆ to_string() [3/10]

auto oxy::to_string ( eType const & v)
inline

Converts an enumeration value to its string representation.

Parameters
vThe enumeration value to convert.
Returns
A string containing the name of the enumeration value.

◆ to_string() [4/10]

auto oxy::to_string ( local_time_point const & aclock) -> std::string
inline

Converts a local time point to a string representation in ISO 8601 format.

Parameters
aclockThe local time point to convert.
Returns
A string representing the local time point in ISO 8601 format (YYYY-MM-DDTHH:MM:SS).

Referenced by make_nil_uuid(), make_uuid(), oxy::hash_fn::operator()(), oxy::make_tmpfile_fn::operator()(), and oxy::sha1sum_fn::operator()().

◆ to_string() [5/10]

auto oxy::to_string ( object_t const & v)
inline

Converts an object_t to its string representation.

Parameters
vThe object_t to convert to a string.
Returns
A string representation of the object_t.

References dumps().

◆ to_string() [6/10]

auto oxy::to_string ( oid_t const & v)
inline

Converts a oid_t object to its string representation.

Parameters
vThe oid_t object to convert.
Returns
A string representation of the oid_t object.

◆ to_string() [7/10]

auto oxy::to_string ( record_t const & v)
inline

Converts a record_t object to its string representation.

Parameters
vThe record_t object to convert.
Returns
A string representation of the entry_t object.

References dumps().

◆ to_string() [8/10]

auto oxy::to_string ( signature_t const & v)
inline

Converts a signature_t object to its string representation.

Parameters
vThe signature_t object to convert.
Returns
A string representation of the signature_t object.

References dumps().

◆ to_string() [9/10]

auto oxy::to_string ( time_point const & aclock) -> std::string
inline

Converts a system clock time point to a string representation in ISO 8601 format.

Parameters
aclockThe system clock time point to convert.
Returns
A string representing the system clock time point in ISO 8601 format (YYYY-MM-DDTHH:MM:SS).

◆ to_string() [10/10]

auto oxy::to_string ( timestamp_t const & v)
inline

Converts a timestamp_t object to its string representation.

Parameters
vThe timestamp_t object to convert.
Returns
A string representation of the timestamp_t object.

◆ to_utc_long_string()

auto oxy::to_utc_long_string ( utc_time_point const & aclock) -> std::string
inline

Converts a UTC clock time point to a string representation in ISO 8601 format with microseconds.

Parameters
aclockThe UTC clock time point to convert.
Returns
A string representing the UTC clock time point in ISO 8601 format with microseconds

Referenced by get_long_timestamp(), and to_long_string().

◆ to_utc_string() [1/2]

auto oxy::to_utc_string ( time_point const & aclock) -> std::string
inline

Converts a UTC clock time point to a string representation in ISO 8601 format.

Parameters
aclockThe UTC clock time point to convert.
Returns
A string representing the UTC clock time point in ISO 8601 format (YYYY-MM-DDTHH:MM:SS).

Referenced by get_short_timestamp().

◆ to_utc_string() [2/2]

auto oxy::to_utc_string ( utc_time_point const & aclock) -> std::string
inline

Converts a UTC clock time point to a string representation in ISO 8601 format with microseconds.

Parameters
aclockThe UTC clock time point to convert.
Returns
A string representing the UTC clock time point in ISO 8601 format with microseconds

Variable Documentation

◆ is_blob

auto oxy::is_blob = [](const object_t &obj) { return obj.type() == eType::blob; }
constexpr

Helper to check if the object belongs to the blob type.

Parameters
object- Define the target object.
Returns
true or false

◆ is_commit

auto oxy::is_commit = [](const object_t &obj) { return obj.type() == eType::commit; }
constexpr

Helper to check if the object belongs to the commit type.

Parameters
object- Define the target object.
Returns
true or false

◆ is_tree

auto oxy::is_tree = [](const object_t &obj) { return obj.type() == eType::index; }
constexpr

Helper to check if the object belongs to the index type.

Parameters
object- Define the target object.
Returns
true or false