Repository

open class Repository

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun close()

Closes the repository.

Link copied to clipboard
suspend fun createDirectory(path: String)

Creates a new directory at the given path in the repository.

Link copied to clipboard
suspend fun createFile(path: String): File

Creates a new file at the given path in the repository.

Link copied to clipboard
suspend fun createMirror(host: String)

Creates mirror of this repository on the given cache server host.

Link copied to clipboard
suspend fun delete()

Delete the repository

Link copied to clipboard
suspend fun deleteMirror(host: String)

Deletes mirror of this repository from the given cache server host.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
suspend fun export(outputPath: String): String

Export repository to file

Link copied to clipboard
suspend fun fileExists(path: String): Boolean
Link copied to clipboard
suspend fun getAccessMode(): AccessMode

Returns the access mode (blind, read or write) the repository is currently opened in.

Link copied to clipboard
Link copied to clipboard
suspend fun getCredentials(): ByteArray

Gets the current credentials of this repository. Can be used to restore access after closing and reopening the repository.

Link copied to clipboard
suspend fun getEntryType(path: String): EntryType?

Returns the type of repository entry (file, directory, ...) or None if the entry doesn't exist.

Link copied to clipboard
suspend fun getExpiration(): Duration?
Link copied to clipboard
suspend fun getInfoHash(): String

Return the info-hash of the repository formatted as hex string. This can be used as a globally unique, non-secret identifier of the repository.

Link copied to clipboard
suspend fun getMetadata(key: String): String?
Link copied to clipboard
suspend fun getMountPoint(): String?
Link copied to clipboard
suspend fun getPath(): String
Link copied to clipboard
suspend fun getQuota(): QuotaInfo
Link copied to clipboard
suspend fun getShortName(): String
Link copied to clipboard
suspend fun getStats(): Stats
Link copied to clipboard
suspend fun getSyncProgress(): Progress

Returns the synchronization progress of this repository as the number of bytes already synced (Progress.value) vs. the total size of the repository in bytes (Progress.total).

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
suspend fun isDhtEnabled(): Boolean

Is Bittorrent DHT enabled?

Link copied to clipboard
suspend fun isPexEnabled(): Boolean

Is Peer Exchange enabled?

Link copied to clipboard
suspend fun isSyncEnabled(): Boolean

Returns whether syncing with other replicas is enabled for this repository.

Link copied to clipboard
suspend fun mirrorExists(host: String): Boolean

Checks if this repository is mirrored on the given cache server host.

Link copied to clipboard
suspend fun mount(): String
Link copied to clipboard
suspend fun move(dst: String)
Link copied to clipboard
suspend fun moveEntry(src: String, dst: String)

Moves an entry (file or directory) from src to dst.

Link copied to clipboard
suspend fun openFile(path: String): File

Opens an existing file at the given path in the repository.

Link copied to clipboard

Returns the entries of the directory at the given path in the repository.

Link copied to clipboard
suspend fun removeDirectory(path: String, recursive: Boolean = false)

Removes the directory at the given path from the repository. If recursive is true it removes also the contents, otherwise the directory must be empty.

Link copied to clipboard
suspend fun removeFile(path: String)

Removes (deletes) the file at the given path from the repository.

Link copied to clipboard
suspend fun resetAccess(token: ShareToken)
Link copied to clipboard
suspend fun setAccess(read: AccessChange?, write: AccessChange?)

Sets, unsets or changes local secrets for accessing the repository or disables the given access mode.

Link copied to clipboard
suspend fun setAccessMode(accessMode: AccessMode, localSecret: LocalSecret? = null)

Switches the repository to the given access mode.

Link copied to clipboard
suspend fun setBlockExpiration(value: Duration?)
Link copied to clipboard
suspend fun setCredentials(credentials: ByteArray)

Sets the current credentials of the repository.

Link copied to clipboard
suspend fun setDhtEnabled(enabled: Boolean)

Enables/disabled Bittorrent DHT (for peer discovery).

Link copied to clipboard
suspend fun setExpiration(value: Duration?)
Link copied to clipboard
suspend fun setMetadata(edits: List<MetadataEdit>): Boolean
Link copied to clipboard
suspend fun setPexEnabled(enabled: Boolean)

Enables/disables Peer Exchange (for peer discovery).

Link copied to clipboard
suspend fun setQuota(value: StorageSize?)
Link copied to clipboard
suspend fun setSyncEnabled(enabled: Boolean)

Enabled or disables syncing with other replicas.

Link copied to clipboard
suspend fun share(accessMode: AccessMode, localSecret: LocalSecret? = null): ShareToken

Creates a share token to share this repository with other devices.

Link copied to clipboard

Subscribe to repository events.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
suspend fun unmount()