ChunkManager

class ChunkManager(config: ChunksConfig, chunkQueue: ChunkQueue? = null)

Manages the upload of chunks to nRF Cloud Observability service.

By default, the ChunkQueue lives in memory. If the application is closed or crashes with chunks un-sent, they will be lost.

If this is an issue for your application, you can provide the ChunkQueue that is persistent, for example PersistentChunkQueue.

Parameters

config

Device configuration which includes Authorization Token and device ID (serial number).

chunkQueue

A queue for storing chunks to be uploaded. If null, a default in-memory queue will be used. Use PersistentChunkQueue for persistent storage using.

Constructors

Link copied to clipboard
constructor(config: ChunksConfig, chunkQueue: ChunkQueue? = null)

Types

Link copied to clipboard
sealed interface State

Status of the manager.

Properties

Link copied to clipboard
val status: StateFlow<ChunkManager.State>

A StateFlow representing the current status of the manager.

Functions

Link copied to clipboard
fun close()

Closes the uploader.

Link copied to clipboard
suspend fun uploadChunks()

Uploads already collected chunks to the cloud.