Archive Service APIs

The following APIs are exposed by the Archive Service:

    /**
     * Return the number of archived transactions including their
     * backchain from the archive log tables for a given well known party.
     *
     * @param party Party whose transaction count to return
     * @param withBackchain Include all transactions in the backchain
     */
    fun getArchivedTransactionCount(party: Party, withBackchain: Boolean = false): Int {
        return BackchainIterator(archivableJobManager, party, withBackchain).getCount()
    }

    /**
     * Returns an iterator to retrieve the list of transactions including their
     * backchain from the archive log tables for a given well known party.
     *
     * @param party Party whose transactions to return
     * @param withBackchain Include all transactions in the backchain
     */
    fun getArchivedTransactions(party: Party, withBackchain: Boolean = false): Iterable<String> {
        return BackchainIterator(archivableJobManager, party, withBackchain)
    }

The following flows are exposed by the Archive Service:

/**
 * Invoke the list jobs flow to return details on the current archive job.
 */
@InitiatingFlow
@StartableByRPC
class ListJobsFlow: FlowLogic<List<ArchivingJob>>()

/**
 * Invoke the list items flow to return details on the archivable items.
 *
 * If [filterList] is null then use the default list of filters, if the list is empty
 * then apply no filters. The [filterConfig] should be a map that can be parsed into a TypeSafe
 * config object containing the necessary filter configuration details.
 *
 * An additional configuration for the selected filters can also be provided in the cordapp's conf file.
 *
 * @property filterList list of filter names
 * @property filterConfig configuration parameters for the filters
 * @property listArchivableItems return transaction and attachment IDs
 */
@InitiatingFlow
@StartableByRPC
class ListItemsFlow(
    private val filterList: List<String>?,
    private val filterConfig: Map<String, Any>,
    private val listArchivableItems: Boolean
) : FlowLogic<ListItemsResults>()

/**
  * Invoke the mark items flow to mark list items as archivable.
  *
  * If [filterList] is null then use the default list of filters, if the list is empty
  * then apply no filters. The [filterConfig] should be a map that can be parsed into a TypeSafe
  * config object containing the necessary filter configuration details.
  *
  * An additional configuration for the selected filters can also be provided in the cordapp's conf file.
  *
  * @property snapshot name of the archive snapshot recorded in the archive log tables
  * @property filterList list of filter names
  * @property filterConfig configuration parameters for the filters
  */
 @InitiatingFlow
 @StartableByRPC
 class MarkItemsFlow(
     private val snapshot: String?,
     private val filterList: List<String>?,
     private val filterConfig: Map<String, Any>
 ) : FlowLogic<MarkItemsResults>()

/**
 * Copy the marked items from the vault schema to the archive schema.
 *
 * @property additionalTransactionTables List of any addition transaction tables to copy
 * @property additionalAttachmentTables List of any additional attachment tables to copy
 * @property additionalQueryableTables List of any queryable tables to copy
 * @property record If true then record SQL rather than execute it
 */
@InitiatingFlow
@StartableByRPC
class CreateSnapshotFlow(
    private val additionalTransactionTables: List<Pair<String, String>>,
    private val additionalAttachmentTables: List<Pair<String, String>>,
    private val additionalQueryableTables: List<Pair<String, String>>,
    private val record: Boolean
) : FlowLogic<CreateSnapshotResults>()

/**
 * Export the archived items to long-term storage.
 *
 * @property exporterList list of exporters to execute
 * @property exporterConfig exporter configuration data
 */
@InitiatingFlow
@StartableByRPC
class ExportSnapshotFlow(
    private val exporterList: List<String>?,
    private val exporterConfig: Map<String, Any>
) : FlowLogic<ExportSnapshotResults>()

/**
 * Import the archived items from long-term storage.
 * The value of [importer] can be null if the importer is specified in [importerConfig]
 * or in the CorDapp configuration.
 *
 * @property snapshot Snapshot to import
 * @property importer Importer to execute
 * @property importerConfig Importer configuration data
 * @property record Record SQL
 */
@InitiatingFlow
@StartableByRPC
class ImportSnapshotFlow(
    private val snapshot: String,
    private val importer: String?,
    private val importerConfig: Map<String, Any>,
    private val record: Boolean
) : FlowLogic<ImportSnapshotResults>()

/**
 * Delete the marked items from the vault schema.
 *
 * @property record If true then record SQL rather than execute it
 */
@InitiatingFlow
@StartableByRPC
class DeleteMarkedFlow(
    private val record: Boolean = false
) : FlowLogic<DeleteMarkedResults>()

/**
 * Delete the marked items from the archive schema.
 *
 * @property record If true then record SQL rather than execute it
 */
@InitiatingFlow
@StartableByRPC
class DeleteSnapshotFlow(
    private val record: Boolean = false
) : FlowLogic<DeleteSnapshotResults>()

/**
 * Restore any items deleted from the vault as part of an archive job.
 * There should never be more than one pending job, however
 * this flow must restore all pending jobs to guarantee that the vault is consistent.
 *
 * @property record If true then record SQL rather than execute it
 */
@InitiatingFlow
@StartableByRPC
class RestoreSnapshotFlow(
    private val record: Boolean
) : FlowLogic<RestoreSnapshotResults>()

Was this page helpful?

Thanks for your feedback!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.

We're sorry this page wasn't helpful. Let us know how we can make it better!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Create an issue

Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.