Ditto  5.1.0
Namespaces | Classes | Typedefs | Enumerations | Functions
ditto Namespace Reference

Namespace for the Ditto C++ SDK types and functions. More...

Namespaces

 internal
 Namespace for internal Ditto SDK functionality.
 

Classes

class  any
 Polyfill of std::any for C++11. More...
 
class  Attachment
 Represents an attachment and can be used to insert the associated attachment into a document at a specific key. More...
 
struct  AttachmentFetcherEventHandler
 A thin wrapper around a function that will get called when there are updates relating to an attempt to fetch an attachment. More...
 
class  AttachmentFetcher
 These objects are returned by calls to Store::fetch_attachment. More...
 
struct  AttachmentFetchEvent
 The different types of attachment fetch events that can be delivered. More...
 
struct  AttachmentFetchEventCompleted
 An attachment fetch event used when the attachment's download has completed. More...
 
struct  AttachmentFetchEventProgress
 An attachment fetch event used when the attachment's download has progressed but is not yet complete. More...
 
struct  AttachmentFetchEventDeleted
 An attachment fetch event used when the attachment is deleted. More...
 
class  AttachmentToken
 Serves as a token for a specific attachment that you can pass to a call to Store::fetch_attachment. More...
 
class  AuthenticationCallback
 Provides feedback to the developer about Ditto authentication status. More...
 
struct  AuthenticationStatus
 Provides info about the authentication status. More...
 
class  AuthenticationStatusObserver
 
class  Authenticator
 Provides access to authentication information and methods for logging on to Ditto Cloud. Relevant when using an OnlineWithAuthentication or an Online identity. More...
 
class  ConnectionRequest
 Contains information about a remote peer that has requested a connection. More...
 
struct  Diff
 Represents differences between two arrays of items. More...
 
class  Differ
 Calculates diffs between arrays of QueryResultItem elements. More...
 
class  DiskUsageItem
 
class  DiskUsageObserver
 
class  DiskUsage
 Provides an interface to be able to monitor local files. More...
 
class  Ditto
 The entrypoint to the Ditto SDK. More...
 
struct  DittoConfig
 Configuration options for initializing a Ditto instance. More...
 
struct  DocumentId
 An identifier for a Document. More...
 
class  DittoError
 All errors that are thrown by the Ditto SDK are wrapped as a DittoError. More...
 
class  AttachmentNotFoundError
 
class  AttachmentTokenInvalidError
 
class  FailedToFetchAttachmentError
 
class  AttachmentFilePermissionDeniedError
 
class  AttachmentFileNotFoundError
 
class  FailedToCreateAttachmentError
 
class  ValidationNotAMapError
 
class  ValidationSizeLimitExceededError
 
class  ValidationNotJSONCompatibleError
 
class  TransactionReadOnlyError
 
class  IOAlreadyExistsError
 
class  IONotFoundError
 
class  IOPermissionDeniedError
 
class  IOOperationFailedError
 
class  PersistenceDirectoryLockedError
 
class  Logger
 Main singleton (global instance) to tweak the behavior of Ditto's logging infrastructure. More...
 
class  Observer
 An observation token returned by any observation API in the Ditto SDK. Retain this object to continue receiving updates. More...
 
class  Presence
 
class  DittoAddress
 Information used to identify a peer. More...
 
class  Connection
 Represents a connection between two peers in a Ditto mesh network. More...
 
class  Peer
 Represent a known peer in the Ditto network. More...
 
class  PresenceGraph
 Represents the Ditto mesh network of peers and their connections between each other. The localPeer is the entry point, all others are remote peers known by the local peer (either directly or via other remote peers). More...
 
class  QueryResultItem
 Represents a single match of a DQL query, similar to a "row" in SQL terms. It is a reference type serving as a "cursor", allowing for efficient access of the underlying data in various formats. More...
 
class  QueryResult
 Represents the returned results when executing a DQL query, containing a QueryResultItem for each match. More...
 
class  SmallPeerInfo
 The entrypoint for small peer user info collection. More...
 
struct  StoreObserverHash
 Defines hashing for shared_ptr-wrapped StoreObserver objects. More...
 
struct  StoreObserverEq
 Defines equality for shared_ptr-wrapped StoreObserver objects. More...
 
class  Store
 Provides access to Collections and a transaction API. More...
 
class  StoreObserver
 
struct  SyncSubscriptionHash
 Defines hashing for shared_ptr-wrapped SyncSubscription objects. More...
 
struct  SyncSubscriptionEq
 Defines equality for shared_ptr-wrapped SyncSubscription objects. More...
 
class  Sync
 Provides access to sync related functionality of Ditto. More...
 
class  SyncSubscription
 A sync subscription configures Ditto to receive updates from remote peers about documents matching the subscription's query. More...
 
class  TransactionOptions
 Options for configuring a transaction. More...
 
struct  TransactionInfo
 Encapsulates information about a transaction. More...
 
class  Transaction
 Represents a transaction in the Ditto store. More...
 
class  TcpListenConfig
 Part of the Listen config that relates to incoming TCP connections. More...
 

Typedefs

using AuthenticationExpirationHandler = std::function< void(Ditto &ditto, uint32_t sec_remaining)>
 Callback function type used with Authenticator::set_expiration_handler.
 
using ConnectionRequestHandler = std::function< ConnectionRequestAuthorization(ConnectionRequest)>
 
using IndexSet = std::set< std::size_t >
 A set of indexes into a vector.
 
using DiskUsageCallback = std::function< void(DiskUsageItem)>
 A function that will get called when there are updates relating to a live query associated with a single document.
 
using PresenceCallback = std::function< void(const PresenceGraph &)>
 A type representing a callback that will get called when there are updates relating to presence.
 
using PresenceObserver = std::shared_ptr< PresenceCallback >
 
using Pubkey = std::vector< uint8_t >
 
using ValueMap = std::unordered_map< std::string, any >
 
using StoreObservationHandler = std::function< void(QueryResult)>
 A function that will get called when there are updates relating to a store observer.
 
using SignalNext = std::function< void()>
 
using StoreObservationHandlerWithSignalNext = std::function< void(QueryResult, SignalNext)>
 A function that will get called when there are updates relating to a store observer, that also has an associated function to call when the next event is ready to be delivered.
 
using SyncSubscriptionSet = std::unordered_set< std::shared_ptr< SyncSubscription >, SyncSubscriptionHash, SyncSubscriptionEq >
 

Enumerations

enum class  AttachmentFetchEventType { Completed , Progress , Deleted }
 The different types of attachment fetch events that can be delivered.
 
enum class  ConnectionRequestAuthorization { deny , allow }
 Indicates whether a connection request should be authorized. More...
 
enum class  ConnectionType {
  bluetooth = 1 , accessPoint , p2pWiFi , webSocket ,
  unknown , multicast
}
 The type of connection between two peers signaling what transport is being used for it. More...
 
enum  FileSystemType { Directory , File , SymLink }
 
enum  LogLevel {
  error = 1 , warning , info , debug ,
  verbose
}
 The log levels that the Ditto SDK supports.
 
enum class  TransactionCompletionAction { commit , rollback }
 Represents an action that completes a transaction, by either committing it or rolling it back. More...
 

Functions

template<typename T >
any_cast (ditto::any const &operand)
 
void to_json (nlohmann::json &j, const Attachment &a)
 
bool operator== (const AuthenticationStatus &lhs, const AuthenticationStatus &rhs)
 
bool operator!= (const AuthenticationStatus &lhs, const AuthenticationStatus &rhs)
 
void to_json (nlohmann::json &j, const DittoConfig &c)
 
void from_json (const nlohmann::json &j, DittoConfig &c)
 
void to_json (nlohmann::json &j, const DocumentId &d_id)
 
std::vector< uint8_t > validate_id_cbor (nlohmann::json &input_val)
 
std::size_t fnv_1a_hash (const std::vector< std::uint8_t > &data) noexcept
 Computes a 64-bit FNV-1a hash of a byte vector. More...
 
void from_json (const nlohmann::json &j, TransactionInfo &c)
 Deserialize a JSON/CBOR object into a TransactionInfo object.
 
void to_json (nlohmann::json &j, const TransactionInfo &c)
 Serialize a TransactionInfo object into a JSON/CBOR object.
 

Detailed Description

Namespace for the Ditto C++ SDK types and functions.

Typedef Documentation

◆ ConnectionRequestHandler

A handler for connection requests from other peers.

Set a ConnectionRequestHandler on Presence::connection_request_handler to allow or deny connection requests from other peers.

Parameters
connection_requestcontains information about the remote peer that can be used to make an authorization decision.
Returns
ConnectionRequestAuthorization::allow if the request should be authorized, ConnectionRequestAuthorization::deny otherwise

Enumeration Type Documentation

◆ ConnectionRequestAuthorization

Indicates whether a connection request should be authorized.

Enumerator
deny 

The connection request will be denied.

allow 

The connection request will be allowed.

◆ ConnectionType

enum ditto::ConnectionType
strong

The type of connection between two peers signaling what transport is being used for it.

Enumerator
multicast 

This value is defined for cross-SDK compatibility. The C++ SDK cannot configure or create reliable UDP multicast connections. Presence may nevertheless report multicast edges learned from the mesh and peers reachable through them.

◆ TransactionCompletionAction

Represents an action that completes a transaction, by either committing it or rolling it back.

Enumerator
commit 

Represents the action of committing a transaction.

rollback 

Represents the action of rolling back a transaction.

Function Documentation

◆ fnv_1a_hash()

std::size_t ditto::fnv_1a_hash ( const std::vector< std::uint8_t > &  data)
inlinenoexcept

Computes a 64-bit FNV-1a hash of a byte vector.

FNV-1a is a non-cryptographic hash function that provides good distribution properties and is suitable for hash table implementations.

Parameters
dataThe byte vector to hash
Returns
The 64-bit FNV-1a hash value