Package live.ditto

Types

Link copied to clipboard
class D

A token returned by observePeersV2(). Call close() to unsubscribe this handler.

Link copied to clipboard
class DiskUsage

Entrypoint for accessing information about the amount of disk storage used by Ditto. This class can't be instantiated. You can access an instance through the ditto.diskUsage API.

Link copied to clipboard
interface DiskUsageCallback

Typically this will only be used if interacting with the SDK from Java. You can call observe with an object that implements this interface.

Link copied to clipboard
data class DiskUsageItem(    val type: FileSystemType,     val path: String,     val sizeInBytes: Int,     val childItems: List<DiskUsageItem>?)

A directory or file in the Ditto working directory. Directories can be traversed by accessing the children property. Files won't have any children.

Link copied to clipboard
class DiskUsageObserverHandle(dittoHandle: SWIGTYPE_p_CDitto, eventHandler: (DiskUsageItem) -> Unit) : DiskUsageObserverRust, Closeable

Opaque handle for disk usage observation. Callback start immediately. Call close() to stop.

Link copied to clipboard
class Ditto @JvmOverloads constructor(dependencies: DittoDependencies, identity: DittoIdentity = DittoIdentity.OfflinePlayground(dependencies)) : DittoBase

Ditto is the entry point for accessing Ditto-related functionality in the Android SDK.

Link copied to clipboard
data class DittoAddress

An address uniquely representing another device on the Ditto network.

Link copied to clipboard
class DittoAttachment : Closeable

Represents an attachment and can be used to insert the associated attachment into a document at a specific key.

Link copied to clipboard
class DittoAttachmentFetcher : Closeable

These objects are returned by calls to fetchAttachment on DittoCollections.

Link copied to clipboard
sealed class DittoAttachmentFetchEvent

The different events that can occur in relation to an attachment fetch.

Link copied to clipboard
interface DittoAttachmentFetchEventHandler

Typically this will only be used if interacting with the SDK from Java. You can call fetchAttachment with an attachment token and an object that implements this interface.

Link copied to clipboard

The different types of DittoAttachmentFetchEvent.

Link copied to clipboard
class DittoAttachmentToken

Serves as a token for a specific attachment that you can pass to a call to fetchAttachment on a DittoCollection.

Link copied to clipboard
interface DittoAuthenticationCallback

Provides feedback to the developer about Ditto authentication status.

Link copied to clipboard
data class DittoAuthenticationStatus(val isAuthenticated: Boolean, val userId: String?)

Provides info about the authentication status.

interface DittoAuthenticationStatusDidChangeCallback

Typically this will only be used if interacting with the SDK from Java. You can call observeStatus() with an object that implements this interface.

Link copied to clipboard
class DittoAuthenticator

Log in to a remote authentication service, using an OnlineWithAuthentication or an Online identity.

Link copied to clipboard
abstract class DittoBase @JvmOverloads constructor(dependencies: DittoDependencies, identity: DittoIdentity = DittoIdentity.OfflinePlayground(dependencies)) : Closeable

Base class for accessing Ditto-related functionality in the Android and Java SDKs. Use the Ditto class for your platform to create an instance.

Link copied to clipboard
class DittoBus

Send and receive messages with remote Ditto peers in the mesh.

Link copied to clipboard
interface DittoBusCallback

Callbacks relating to Ditto Bus for both receiving single messages and accepting incoming streams.

Link copied to clipboard
data class DittoBusMessage
Link copied to clipboard
enum DittoBusReliability : Enum<DittoBusReliability>
Link copied to clipboard
class DittoBusStream

A message-based communication channel to another peer in the mesh.

Link copied to clipboard
interface DittoBusStreamCallback

Callbacks required to use the Ditto Bus API with explicit stream handles.

Link copied to clipboard
interface DittoCallback

The callback property of Ditto instances can be set to be an object that implements this interface.

Link copied to clipboard
class DittoCollection

A reference to a collection in a DittoStore.

Link copied to clipboard
interface DittoCollectionsCallback

Typically this will only be used if interacting with the SDK from Java. You can call observeLocal with an object that implements this interface.

Link copied to clipboard
data class DittoCollectionsEvent(    val isInitial: Boolean,     val collections: List<DittoCollection>,     val oldCollections: List<DittoCollection>,     val insertions: List<Int>,     val deletions: List<Int>,     val updates: List<Int>,     val moves: List<DittoLiveQueryMove>)

Provides information about the changes that have occurred in relation to an event delivered when observing the collections in a DittoStore. It contains information about the collections that are known as well as the collections that were previously known in the previous event, along with information about what collections have been inserted, deleted, updated, or moved since the last event.

Link copied to clipboard
interface DittoCollectionsWithNextSignalCallback

Typically this will only be used if interacting with the SDK from Java. You can call observeLocalWithNextSignal with an object that implements this interface.

Link copied to clipboard
enum DittoConditionSource : Enum<DittoConditionSource>
Link copied to clipboard
data class DittoConnection(    val id: String,     val peer1: DittoAddress,     val peer2: DittoAddress,     val connectionType: DittoConnectionType,     val approximateDistanceInMeters: Double?)

Represents a connection between two peers on the Ditto mesh network.

Link copied to clipboard
enum DittoConnectionPriority : Enum<DittoConnectionPriority>

The priority with which the local device should reach out to particular remote peers in the Ditto mesh.

Link copied to clipboard
enum DittoConnectionType : Enum<DittoConnectionType>

The type of DittoConnection between two DittoPeers signaling what transport is being used.

Link copied to clipboard
open class DittoCounter

Container for a number. See DittoMutableCounter which can be incremented and decremented.

Link copied to clipboard
interface DittoDependencies

An interface describing the dependencies required to initialise a Ditto instance.

Link copied to clipboard
class DittoDocument

A document belonging to a DittoCollection with an inner value.

Link copied to clipboard
data class DittoDocumentId

An identifier for a DittoDocument.

Link copied to clipboard
class DittoDocumentIdPath

Provides an interface to specify a path to a key in a document identifier that you can then call a function on to get the value at the specified key as a specific type. You obtain a DittoDocumentIdPath by subscripting a DittoDocumentId and you can then further subscript a DittoDocumentIdPath to further specify the key of the document identifier that you want to get the value of.

Link copied to clipboard
class DittoDocumentPath

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. You obtain a DittoDocumentPath by subscripting a DittoDocument and you can then further subscript a DittoDocumentPath to further specify the key of the document that you want to get the value of.

Link copied to clipboard
sealed class DittoError : Throwable

All errors that are thrown by the Ditto SDK are wrapped as a DittoError. It wraps multiple different types of error that each have an associated reason.

Link copied to clipboard
class DittoExperimental

Upcoming SDK features made available for prototyping.

Link copied to clipboard
sealed class DittoIdentity

The various identity configurations that you can use when initializing a Ditto instance.

Link copied to clipboard
class DittoLiveQuery : Closeable

The type that is returned when calling observeLocal on a DittoCollection object. It handles the logic for calling the event handler that is provided to the observeLocal call.

Link copied to clipboard
interface DittoLiveQueryCallback

Typically this will only be used if interacting with the SDK from Java. You can call observeLocal with an object that implements this interface.

Link copied to clipboard
sealed class DittoLiveQueryEvent

Describes the different types of event that you can receive when dealing with live queries.

Link copied to clipboard
data class DittoLiveQueryMove(val from: Int, val to: Int)

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

Link copied to clipboard
interface DittoLiveQueryWithNextSignalCallback

Typically this will only be used if interacting with the SDK from Java. You can call observeLocalWithNextSignal with an object that implements this interface.

Link copied to clipboard
object DittoLog

Main singleton (global instance) to use / call into ditto_log and thus our logging API.

Link copied to clipboard
interface DittoLogCallback

Typically this will only be used if interacting with the SDK from Java. You can call setCustomLogCallback with an object that implements this interface.

Link copied to clipboard
interface DittoLogDecorator

This is an interface allowing to shim / wrap a call to ditto_log from the dittoffi.

Link copied to clipboard
object DittoLogger : LoggerCb

Main singleton (global instance) to tweak the behavior of Ditto's logging infrastructure.

Link copied to clipboard
interface DittoLoginCompletionCallback

Typically this will only be used if interacting with the SDK from Java. You can call loginWithToken or loginWithCredentials with an object that implements this interface.

Link copied to clipboard
enum DittoLogLevel : Enum<DittoLogLevel>
Link copied to clipboard
interface DittoLogoutCleanupFn

Typically this will only be used if interacting with the SDK from Java. You can call logout with an object that implements this interface.

Link copied to clipboard
class DittoMutableCounter : DittoCounter

Container for a number that can be incremented and decremented.

Link copied to clipboard
class DittoMutableDocument

This is used as part of update operations for documents. It provides access to updating a document through a subscript-based API. A subscript operation returns a DittoMutableDocumentPath that you can then use to chain further subscript operations to in order to access nested values in a document. Once you've defined the path to a key in a document that you'd like to update, by using subscripts, then you can use the functionality defined on DittoMutableDocumentPath to perform the desired document update(s). Note that objects of this type should only be used within the scope of the update closure that they are provided in.

Link copied to clipboard
class DittoMutableDocumentPath

Provides an interface to specify a path to a key in a document that you can then call various update functions on. You obtain a DittoMutableDocumentPath by subscripting a DittoMutableDocument and you can then further subscript a DittoMutableDocumentPath to further specify the key of the document that you want to update.

Link copied to clipboard
interface DittoMutableDocumentsUpdater

Typically this will only be used if interacting with the SDK from Java. You can call update with an object that implements this interface.

Link copied to clipboard
class DittoMutableRegister : DittoRegister

Represents a mutable CRDT register that can be updated while updating a document. This class can't be instantiated directly, it's returned automatically for any register property within an update block. See also the register properties of DittoDocumentPath and DittoMutableDocumentPath.

Link copied to clipboard
class DittoObserverManager : Observable

Provides feedback to the developer about Ditto authentication status.

Link copied to clipboard
data class DittoPeer(    val address: DittoAddress,     val deviceName: String,     val connections: List<DittoConnection>,     val os: String?,     val isConnectedToDittoCloud: Boolean,     val isCompatible: Boolean?,     val dittoSdkVersion: String?,     val queryOverlapGroup: Int)

An instance of Ditto taking part in the mesh network.

Link copied to clipboard
interface DittoPeersObserver : DittoPresenceObserver

A token returned by observePeers() and observePeersV2(). Call close() to unsubscribe this handler.

Link copied to clipboard
class DittoPeersObserverV1 : DittoPeersObserver

A token returned by observePeers(). Call close() to unsubscribe this handler.

Link copied to clipboard
interface DittoPeersObserverV1Callback

Typically this will only be used if interacting with the SDK from Java. You can call observePeers on a Ditto instance with an object that implements this interface.

Link copied to clipboard
class DittoPeersObserverV2 : DittoPeersObserver
Link copied to clipboard
interface DittoPeersObserverV2Callback

Typically this will only be used if interacting with the SDK from Java. You can call observePeersV2 on a Ditto instance with an object that implements this interface.

Link copied to clipboard
class DittoPeerV2Parser
Link copied to clipboard
class DittoPendingCollectionsOperation

These objects are returned when calling collections() on DittoStore.

Link copied to clipboard
class DittoPendingCursorOperation

These objects are returned when using find-like functionality on DittoCollections. They allow chaining of further query-related functions to do things like add a limit to the number of documents you want returned or specify how you want the documents to be sorted and ordered. You can either call exec on the object to get an array of DittoDocuments as an immediate return value, or you can establish either a live query or a subscription, which both work over time. A live query, established by calling observeLocal, will notify you every time there's an update to a document that matches the query you provided in the preceding find-like call. A subscription, established by calling subscribe, will act as a signal to other peers that the device connects to that you would like to receive updates from them about documents that match the query you provided in the preceding find-like call. Update and remove functionality is also exposed through this object.

Link copied to clipboard
class DittoPendingIdSpecificOperation

These objects are returned when using findById functionality on DittoCollections. You can either call exec on the object to get an immediate return value, or you can establish either a live query or a subscription, which both work over time. A live query, established by calling observeLocal, will notify you every time there's an update to the document with the identifier you provided in the preceding findById call. A subscription, established by calling subscribe, will act as a signal to other peers that you would like to receive updates from them about the document with the identifier you provided in the preceding findById call. Update and remove functionality is also exposed through this object.

Link copied to clipboard
data class DittoPresenceGraph

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

Link copied to clipboard
interface DittoPresenceObserver : Closeable

A token returned by presence.observe(). Call close() to unsubscribe this handler.

Link copied to clipboard
interface DittoPresenceObserverCallback

Typically this will only be used if interacting with the SDK from Java. You can call observePeers on a Ditto instance with an object that implements this interface.

Link copied to clipboard
open class DittoRegister(value: Any?)

Container for a number. See DittoMutableCounter which can be incremented and decremented.

Link copied to clipboard
class DittoRemotePeer(    val networkId: String,     val deviceName: String,     val approximateDistance: Double?,     val connections: Array<String>)

A summary snapshot of the types of connections currently active to a remote Ditto peer.

Link copied to clipboard
data class DittoRemotePeerV2

A summary snapshot of a currently-connected peer. observePeersV2 on a Ditto instance with an object that implements this interface.

Link copied to clipboard
class DittoScopedWriteTransaction(baseTransaction: DittoWriteTransaction, val collectionName: String)

DittoScopedWriteTransaction exposes functionality that allows you to perform multiple operations on the store within a single write transaction.

Link copied to clipboard
typealias DittoSignalNext = () -> Unit
Link copied to clipboard
interface DittoSignalNextCallback

The interface that you must implement with the third parameter provided to observeLocalWithNextSignal calls.

Link copied to clipboard
fun interface DittoSingleDocumentLiveQueryCallback

Typically this will only be used if interacting with the SDK from Java. You can call observeLocal with an object that implements this interface.

Link copied to clipboard
class DittoSingleDocumentLiveQueryEvent(val isInitial: Boolean, val oldDocument: DittoDocument?)

Provides information about a live query event relating to a single document live query.

fun interface DittoSingleDocumentLiveQueryWithNextSignalCallback

Typically this will only be used if interacting with the SDK from Java. You can call observeLocalWithNextSignal with an object that implements this interface.

Link copied to clipboard
fun interface DittoSingleMutableDocumentUpdater

Typically this will only be used if interacting with the SDK from Java. You can call update with an object that implements this interface.

Link copied to clipboard
enum DittoSortDirection : Enum<DittoSortDirection>

Describes the direction when sorting a query.

Link copied to clipboard
class DittoStore

Provides access to DittoCollections and a write transaction API.

Link copied to clipboard
class DittoSubscription : Closeable

While DittoSubscription 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.

Link copied to clipboard
enum DittoTransportCondition : Enum<DittoTransportCondition>
Link copied to clipboard
class DittoTransportDiagnostics
Link copied to clipboard
class DittoTransportSnapshot
Link copied to clipboard
sealed class DittoUpdateResult

Describes the result of an update operation performed on a DittoMutableDocument.

Link copied to clipboard
enum DittoWriteStrategy : Enum<DittoWriteStrategy>

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

Link copied to clipboard
class DittoWriteTransaction

DittoWriteTransaction exposes functionality that allows you to perform multiple operations on the store within a single write transaction. You must use the scoped function to get collection-scoped access to the write transaction object, which will then allow you to perform insert, update, remove or evict operations using the write transaction.

Link copied to clipboard
interface DittoWriteTransactionHandler

Typically this will only be used if interacting with the SDK from Java. You can call write on a DittoStore instance with an object that implements this interface.

class DittoWriteTransactionPendingCursorOperation

These objects are returned when using find-like functionality on DittoScopedWriteTransactions. You can use them to perform updates on a document and remove or evict a document.

class DittoWriteTransactionPendingIdSpecificOperation

These objects are returned when using findById functionality on DittoScopedWriteTransactions. You can use them to perform updates on a document and remove or evict a document.

Link copied to clipboard
sealed class DittoWriteTransactionResult

Describes one part of the result of a write transaction.

Link copied to clipboard
enum FileSystemType : Enum<FileSystemType>

Enum for the type of file represented by a DiskUsageItem.

Link copied to clipboard
data class LMDBError(val returnCode: Int) : Throwable
Link copied to clipboard
class NoOpAuthenticationCallback : DittoAuthenticationCallback
Link copied to clipboard
typealias OpenStreamCompletion = (DittoBusStream?, DittoError?) -> Unit
Link copied to clipboard
class Presence : PresenceRust

The entrypoint for all actions that relate presence of other peers known by the current peer, either directly or through other peers.

Link copied to clipboard
typealias SingleSendCompletion = (DittoError?) -> Unit

Functions

Link copied to clipboard
fun doubleFromValue(value: Any?): Double?
Link copied to clipboard
fun floatFromValue(value: Any?): Float?