> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# UNLOAD

> Reference for the `UNLOAD` DLC operation, covering the `DlcUnloadRequest` fields (topics, scope, branch, garbage collection) and the `DlcUnloadResponse` and `UnloadReport` returned.

## Overview

When unloading, elements are deleted from the datastore. The deleted elements are not recorded.

A Garbage collection can be performed after an `UNLOAD` operation. This can be done by specifying
the [Garbage collection scope properties](/functional/scope-parameters#garbage-collection) in the request.

## Request

<Tabs>
  <Tab title="Java">
    ### `DlcUnloadRequest`

    | Key                   | Required | Type          | Description                                                                                      |
    | --------------------- | :------: | :------------ | ------------------------------------------------------------------------------------------------ |
    | topics                |     Y    | `Set<String>` | Set of topics or aliases.                                                                        |
    | scope                 |          | `IDlcScope`   | [Scope Parameters](/functional/scope-parameters)                                                 |
    | branch                |          | `String`      | The branch to unload data from.                                                                  |
    | performGcOnStart      |          | `Boolean`     | Perform a [Garbage collection](/functional/garbage-collection) before the datastore transaction. |
    | performGcOnCompletion |          | `Boolean`     | Perform a [Garbage collection](/functional/garbage-collection) after the datastore transaction.  |

    #### Example:

    ```Java theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
    DlcUnloadRequest.builder()
        .topics("Topic1", "Topic2") // Required
        .scope(DlcScope.of(
    			"AsOfDate", "2025-02-14",
                "performGcOnCompletion", true
        ))
        .branch("BranchToLoadInto")
        .build();
    ```
  </Tab>

  <Tab title="JSON">
    ### `DlcUnloadRequestDTO`

    | Key             | Type                | Description                                |
    | --------------- | :------------------ | ------------------------------------------ |
    | unloadedRecords | `Map<String, Long>` | Number of records removed from each store. |
    | status          | `DlcStatus`         | Overall status of the DLC Operation.       |

    #### Example:

    ```json theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
    {
      "operation": "UNLOAD",
      "topics": ["Topic1", "Topic2"],
      "scope": {
        "AsOfDate": "2025-02-14"
      },
      "performGcOnCompletion": true,
      "branch": "BranchToUnloadFrom"
    }
    ```
  </Tab>
</Tabs>

## Response

<Tabs>
  <Tab title="Java">
    ### `DlcUnloadResponse`

    | Key    | Type           | Description                                          |
    | ------ | :------------- | ---------------------------------------------------- |
    | report | `UnloadReport` | Report of what occurred during the unload operation. |
    | status | `DlcStatus`    | Overall status of the DLC Operation.                 |

    ### `UnloadReport`

    | Key             | Type                | Description                                |
    | --------------- | :------------------ | ------------------------------------------ |
    | unloadedRecords | `Map<String, Long>` | Number of records removed from each store. |

    ### `DlcStatus`

    A simple enum to capture if the DLC request was executed.

    | Key   | Description                                     |
    | ----- | ----------------------------------------------- |
    | OK    | Request was handled successfully.               |
    | ERROR | Request was not able to be performed correctly. |
  </Tab>

  <Tab title="JSON">
    ### `DlcUnloadResponseDTO`

    | Key                     | Type                | Description                                |
    | ----------------------- | :------------------ | ------------------------------------------ |
    | unloadedRecordsPerStore | `Map<String, Long>` | Number of records removed from each store. |
    | status                  | `DlcStatus`         | Overall status of the DLC Operation.       |

    #### Example:

    ```json theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
    {
      "unloadedRecordsPerStore": {
        "StoreA": 12,
        "StoreB": 200
      },
      "status": "OK"
    }
    ```
  </Tab>
</Tabs>
