Ditto 4.13.1
 
Loading...
Searching...
No Matches
ditto Namespace Reference

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

Namespaces

namespace  internal
 Namespace for internal Ditto SDK functionality.
 

Classes

class  AbstractDocumentPath
 Provides an interface to specify a path to a key in a document that you can then call various update functions on. More...
 
class  any
 Polyfill of std::any for C++11. More...
 
class  Arc
 A structure that holds the value and the strong reference count for an Arc. More...
 
struct  ArcPointee
 A structure that holds the value and the strong reference count for an Arc. More...
 
class  Attachment
 Represents an attachment and can be used to insert the associated attachment into a document at a specific key. More...
 
class  AttachmentFetcher
 These objects are returned by calls to Store::fetch_attachment. 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...
 
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  AttachmentFetchEventDeleted
 An attachment fetch event used when the attachment is deleted. More...
 
struct  AttachmentFetchEventProgress
 An attachment fetch event used when the attachment's download has progressed but is not yet complete. More...
 
class  AttachmentFileNotFoundError
 
class  AttachmentFilePermissionDeniedError
 
class  AttachmentNotFoundError
 
class  AttachmentToken
 Serves as a token for a specific attachment that you can pass to a call to Store::fetch_attachment. More...
 
class  AttachmentTokenInvalidError
 
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  AwdlConfig
 Part of the PeerToPeer config that relates to AWDL connections. More...
 
class  BluetoothLeConfig
 Part of the PeerToPeer config that relates to Bluetooth LE connections. More...
 
class  Collection
 A reference to a collection in a Store. More...
 
class  CollectionsEvent
 Provides information about the changes that have occurred in relation to an event delivered when observing the collections in a Store. More...
 
struct  CollectionsEventHandler
 
struct  CollectionsEventWithNextSignalHandler
 
class  Connect
 Part of the TransportConfig that relates to outgoing connections. More...
 
class  Connection
 Represents a connection between two peers in a Ditto mesh network. More...
 
class  ConnectionRequest
 Contains information about a remote peer that has requested a connection. More...
 
class  Counter
 
struct  Diff
 Represents differences between two arrays of items. More...
 
class  Differ
 Calculates diffs between arrays of QueryResultItem elements. More...
 
class  DiskObserverContext
 
class  DiskUsage
 Provides an interface to be able to monitor local files. More...
 
class  DiskUsageChild
 
class  Ditto
 The entrypoint to the Ditto SDK. More...
 
class  DittoAddress
 Information used to identify a peer. More...
 
struct  DittoConfig
 Configuration options for initializing a Ditto instance. More...
 
class  DittoError
 All errors that are thrown by the Ditto SDK are wrapped as a DittoError. More...
 
class  Document
 A document belonging to a Collection with an inner value and an identifier (DocumentId). More...
 
struct  DocumentId
 An identifier for a Document. More...
 
class  DocumentIdPath
 Provides an interface to specify a path to a key in a document ID that you can then call a function on to get the value at the specified key as a specific type. More...
 
class  DocumentPath
 Provides an interface to specify a path to a key in a document that you can then call a function on to get the value at the specified key as a specific type. More...
 
class  FailedToCreateAttachmentError
 
class  FailedToFetchAttachmentError
 
class  Global
 
class  HttpListenConfig
 Part of the Listen config that relates to incoming HTTP connections. More...
 
class  Identity
 The various identity configurations that you can use when initializing a Ditto instance. More...
 
class  IOAlreadyExistsError
 
class  IONotFoundError
 
class  IOOperationFailedError
 
class  IOPermissionDeniedError
 
class  LanConfig
 Part of the PeerToPeer config that relates to LAN connections. More...
 
class  Listen
 Part of the TransportConfig that relates to incoming connections. More...
 
class  LiveQuery
 The type that is returned when calling observe_local. It handles the logic for calling the event handler that is provided to the observe_local call. More...
 
class  LiveQueryEvent
 The events that you receive when dealing with live queries. More...
 
struct  LiveQueryEventHandler
 A thin wrapper around a function that will get called when there are updates relating to a live query. More...
 
struct  LiveQueryMove
 Describes the index in a list of documents that a document was previously found at (from) and the index that it can now be found at (to). More...
 
struct  LiveQueryWithNextSignalEventHandler
 A thin wrapper around a function that will get called when there are updates relating to a live query that has an associated function to call when the next event is ready to be delivered. More...
 
class  Log
 Main singleton (global instance) to tweak the behavior of Ditto's logging infrastructure. More...
 
class  ManualIdentity
 A manually-provided certificate identity. This accepts a base64-encoded bundle. More...
 
class  MutableCounter
 
class  MutableDocument
 This is used as part of update operations for documents. More...
 
class  MutableDocumentPath
 Provides an interface to specify a path to a key in a document that you can then call various update functions on. More...
 
class  MutableRegister
 
class  Observer
 An observation token returned by any observation API in the Ditto SDK. Retain this object to continue receiving updates. More...
 
class  OfflinePlaygroundIdentity
 Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be used for development. In this mode, any string can be used as the ID of the app. More...
 
class  OnlinePlaygroundIdentity
 Test a Ditto Cloud app with weak shared token authentication ("Playground mode"). This is not secure and must only be used for development. More...
 
class  OnlineWithAuthenticationIdentity
 Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication server. User permissions are centrally managed. Sync will not work until a successful login has occurred. More...
 
class  OrderBy
 
class  Peer
 Represent a known peer in the Ditto network. More...
 
class  PeerToPeer
 Part of the TransportConfig that relates to peer-to-peer connections. More...
 
class  PendingCollectionsOperation
 These objects are returned when calling collections() on Store objects. More...
 
class  PendingCursorOperation
 These objects are returned when using find-like functionality on Collection objects. More...
 
class  PendingIDSpecificOperation
 These objects are returned when using Collection::find_by_id functionality. More...
 
class  Presence
 
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  QueryResult
 Represents the returned results when executing a DQL query, containing a QueryResultItem for each match. 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  Register
 
class  ScopedWriteTransaction
 ScopedWriteTransaction exposes functionality that allows you to perform multiple operations on the store within a single write transaction. More...
 
class  SharedKeyIdentity
 A mode where any device is trusted provided they know the secret key. This is a simplistic authentication model normally only suitable for private apps where users and devices are both trusted. In this mode, any string may be used as the app id. More...
 
class  SingleDocumentLiveQueryEvent
 Provides information about a live query event relating to a single document live query. More...
 
struct  SingleDocumentLiveQueryEventHandler
 A thin wrapper around a function that will get called when there are updates relating to a live query associated with a single document. More...
 
struct  SingleDocumentLiveQueryWithNextSignalEventHandler
 A thin wrapper around a function that will get called when there are updates relating to a live query associated with a single document that has an associated function to call when the next event is ready to be delivered. More...
 
class  SmallPeerInfo
 The entrypoint for small peer user info collection. More...
 
class  Store
 Provides access to Collections and a transaction API. More...
 
class  StoreObserver
 
class  Subscription
 While Subscription objects remain in scope they ensure that documents in the collection specified, and that match the query provided, will try to be kept up-to-date with the latest changes from remote peers. More...
 
class  Sync
 
class  SyncSubscription
 A sync subscription configures Ditto to receive updates from remote peers about documents matching the subscription's query. More...
 
class  TcpListenConfig
 Part of the Listen config that relates to incoming TCP connections. More...
 
class  Transaction
 Represents a transaction in the Ditto store. More...
 
struct  TransactionInfo
 Encapsulates information about a transaction. More...
 
class  TransactionOptions
 Options for configuring a transaction. More...
 
class  TransactionReadOnlyError
 
class  TransportConfig
 A configuration object specifying which network transports Ditto should use to sync data. More...
 
struct  UpdateResult
 Provides information about a successful update operation on a document. More...
 
struct  UpdateResultIncremented
 An update result when the update result's type is UpdateResultType::Incremented. More...
 
struct  UpdateResultRemoved
 An update result when the update result's type is UpdateResultType::Removed. More...
 
struct  UpdateResultSet
 An update result when the update result's type is UpdateResultType::Set. More...
 
class  ValidationNotAMapError
 
class  ValidationNotJSONCompatibleError
 
class  ValidationSizeLimitExceededError
 
class  WiFiAwareConfig
 Part of the PeerToPeer transport config that applies to WiFi Aware connections. More...
 
class  WriteTransaction
 WriteTransaction exposes functionality that allows you to perform multiple operations on the store within a single write transaction. More...
 
class  WriteTransactionPendingCursorOperation
 These objects are returned when using find-like functionality on ScopedWriteTransactions. You can use them to perform updates on a document and remove or evict a document. More...
 
class  WriteTransactionPendingIDSpecificOperation
 These objects are returned when ScopedWriteTransaction::find_by_id is called. More...
 
struct  WriteTransactionResult
 Provides information about the result of an operation on a document that was part of a write transaction. More...
 
struct  WriteTransactionResultEvicted
 Represents the write transaction result that will be the value of a WriteTransactionResult when its type is WriteTransactionResultType::Evicted. More...
 
struct  WriteTransactionResultInserted
 Represents the write transaction result that will be the value of a WriteTransactionResult when its type is WriteTransactionResultType::Inserted. More...
 
struct  WriteTransactionResultRemoved
 Represents the write transaction result that will be the value of a WriteTransactionResult when its type is WriteTransactionResultType::Removed. More...
 
struct  WriteTransactionResultUpdated
 Represents the write transaction result that will be the value of a WriteTransactionResult when its type is WriteTransactionResultType::Updated. More...
 

Typedefs

using AuthenticationExpirationHandler
 
using ConnectionRequestHandler
 
using IndexSet = std::set<std::size_t>
 A set of indexes into a vector.
 
using DiskUsageCallback = std::function<void(DiskUsageChild)>
 A function that will get called when there are updates relating to a live query associated with a single document.
 
using SingleDocumentLiveQueryEventCallback
 A function that will get called when there are updates relating to a live query associated with a single document.
 
using SingleDocumentLiveQueryEventWithNextSignalCallback
 A function that will get called when there are updates relating to a live query associated with a single document that has an associated function to call when the next event is ready to be delivered.
 
using LiveQueryEventCallback
 A function that will get called when there are updates relating to a live query.
 
using LiveQueryEventWithNextSignalCallback
 A function that will get called when there are updates relating to a live query that has an associated function to call when the next event is ready to be delivered.
 
using CollectionsEventCallback
 Type of function called by observe methods.
 
using CollectionsEventWithNextSignalCallback
 Type of function called by observe_with_signal methods.
 
using PresenceCallback = std::function<void(PresenceGraph)>
 A type representing a callback that will get called when there are updates relating to presence.
 
using PresenceObserverInternal = std::weak_ptr<PresenceCallback>
 
using PresenceObserver = std::shared_ptr<PresenceCallback>
 
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 NextSignal = std::function<void()>
 
using StoreObservationHandlerWithNextSignal
 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.
 

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
}
 The type of connection between two peers signaling what transport is being used for it.
 
enum  FileSystemType { Directory , File , SymLink }
 
enum class  IdentityType {
  OFFLINE_PLAYGROUND , ONLINE_WITH_AUTHENTICATION , ONLINE_PLAYGROUND , SHARED_KEY ,
  MANUAL
}
 The different types of Identity that can be used with Ditto.
 
enum  LogLevel {
  error = 1 , warning , info , debug ,
  verbose
}
 The log levels that the Ditto SDK supports.
 
enum  SyncScope { BigPeerOnly , LocalPeerOnly }
 
enum class  SortDirection { ascending = 1 , descending }
 
enum class  TransactionCompletionAction { commit , rollback }
 Represents an action that completes a transaction, by either committing it or rolling it back. More...
 
enum class  UpdateResultType { Set , Removed , Incremented }
 Describes the type of result of an update operation performed on a MutableDocument. More...
 
enum class  WriteStrategy { merge = 1 , insertIfAbsent , insertDefaultIfAbsent , updateDifferentValues }
 
enum class  WriteTransactionResultType { Inserted , Removed , Evicted , Updated }
 

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 Counter &a)
 
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::string default_auth_url (std::string app_id)
 Helper function to compute the default auth URL.
 
void to_json (nlohmann::json &j, const Register &a)
 
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.
 
void from_json (const nlohmann::json &j, HttpListenConfig &c)
 
void to_json (nlohmann::json &j, const HttpListenConfig &c)
 
void from_json (const nlohmann::json &j, LanConfig &c)
 
void to_json (nlohmann::json &j, const LanConfig &c)
 
void from_json (const nlohmann::json &j, Connect &c)
 
void to_json (nlohmann::json &j, const Connect &c)
 
WriteStrategyRs_t write_strategy_rs_from_write_strategy (WriteStrategy write_strategy)
 

Variables

const uint32_t NO_PREFERRED_ROUTE_HINT = 0
 

Detailed Description

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

Typedef Documentation

◆ AuthenticationExpirationHandler

using ditto::AuthenticationExpirationHandler
Initial value:
std::function<void(Ditto &ditto, uint32_t sec_remaining)>
The entrypoint to the Ditto SDK.
Definition Ditto.hpp:39
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19

◆ CollectionsEventCallback

Initial value:
std::function<void(CollectionsEvent)>
Provides information about the changes that have occurred in relation to an event delivered when obse...
Definition CollectionsEvent.hpp:26

Type of function called by observe methods.

Deprecated
Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/legacy-to-dql-guide

◆ CollectionsEventWithNextSignalCallback

Initial value:
std::function<void(CollectionsEvent, std::function<void()> &)>

Type of function called by observe_with_signal methods.

Deprecated
Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/legacy-to-dql-guide

◆ ConnectionRequestHandler

Initial value:
Contains information about a remote peer that has requested a connection.
Definition ConnectionRequest.hpp:21
ConnectionRequestAuthorization
Indicates whether a connection request should be authorized.
Definition ConnectionRequestAuthorization.hpp:9

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

◆ LiveQueryEventCallback

Initial value:
std::function<void(std::vector<Document>, LiveQueryEvent)>
The events that you receive when dealing with live queries.
Definition LiveQueryEvent.hpp:20

A function that will get called when there are updates relating to a live query.

Deprecated
Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/legacy-to-dql-guide

◆ LiveQueryEventWithNextSignalCallback

Initial value:
std::function<void(std::vector<Document>, LiveQueryEvent,
std::function<void()> &)>

A function that will get called when there are updates relating to a live query that has an associated function to call when the next event is ready to be delivered.

Deprecated
Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/legacy-to-dql-guide

◆ SingleDocumentLiveQueryEventCallback

Initial value:
std::function<void(std::shared_ptr<Document>,
Provides information about a live query event relating to a single document live query.
Definition SingleDocumentLiveQueryEvent.hpp:21

A function that will get called when there are updates relating to a live query associated with a single document.

Deprecated
Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/legacy-to-dql-guide

◆ SingleDocumentLiveQueryEventWithNextSignalCallback

Initial value:
std::function<void(std::shared_ptr<Document>,
std::function<void()> &)>

A function that will get called when there are updates relating to a live query associated with a single document that has an associated function to call when the next event is ready to be delivered.

Deprecated
Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/legacy-to-dql-guide

◆ StoreObservationHandlerWithNextSignal

Initial value:
std::function<void(QueryResult, NextSignal)>
Represents the returned results when executing a DQL query, containing a QueryResultItem for each mat...
Definition QueryResult.hpp:121

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.

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.

◆ SortDirection

enum class ditto::SortDirection
strong
Deprecated
Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/legacy-to-dql-guide

Describes the direction when sorting a query.

◆ SyncScope

Deprecated
Will be removed in v5

◆ 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.

◆ UpdateResultType

enum class ditto::UpdateResultType
strong

Describes the type of result of an update operation performed on a MutableDocument.

  • Set: Describes the set update that was performed.
  • Removed: Describes the remove update that was performed.
  • Incremented: Describes the increment update that was performed.

◆ WriteStrategy

enum class ditto::WriteStrategy
strong
Deprecated
Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/legacy-to-dql-guide

Defines the various strategies available when inserting a document into a collection.

Enumerator
merge 

The existing document will be merged with the document being inserted, if there is a pre-existing document.

insertIfAbsent 

An existing document will be overwritten. This can be thought of as first removing the existing document completely and then inserting the new document in its place, if there is a pre-existing document.

insertDefaultIfAbsent 

Insert the document, with its contents treated as default data, only if there is not already a document with the same ID in the store. If there is already a document in the store with the same ID then this will be a no-op. Use this strategy if you want to insert default data for a given document ID, which you want to treat as common initial data amongst all peers and that you expect to be mutated or overwritten in due course.

updateDifferentValues 

The existing document will be updated based on the document being inserted. If there is a pre-existing document in the local store with the same ID, compare its value to the current value of the document. Update any differing register and attachment leaf values in the document to match the given value. Nothing is removed. This is equivalent to using an if statement to check each value in the provided payload against the local document value.

  • Warning: In cases of concurrent writes, non-differing values will be overridden by peers because this write strategy excludes values from the given payload that are identical to those in the local store.

◆ WriteTransactionResultType

The types of write transaction result.