> For the complete documentation index, see [llms.txt](https://antidotedb.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://antidotedb.gitbook.io/documentation/architecture/log.md).

# Log

For each vnode in the ring, there exists one log file.

Currently the log is used for 3 things:

* Loading the state of objects into the materialiser on restart (done by replaying the log).
* Resending lost updates to external DCs.
* Reading an older version of an object than what is available in memory.

Each log entry is defined by the following records:

```erlang
-type log_operation() :: #log_operation{}.
-record(log_operation, {
    tx_id :: txid(),
    op_type :: update
             | prepare
             | commit
             | abort
             | noop,
    log_payload :: any_log_payload()
}).


-type any_log_payload() :: #update_log_payload{}
                         | #commit_log_payload{}
                         | #abort_log_payload{}
                         | #prepare_log_payload{}.
-type commit_log_payload() :: #commit_log_payload{}.
-type update_log_payload() :: #update_log_payload{}.
-type op_number() :: #op_number{}.
-type op_name() :: atom().
-type op_param() :: term().
-type op() :: {op_name(), op_param()}.


-record(commit_log_payload, {
    commit_time :: dc_and_commit_time(),
    snapshot_time :: snapshot_time()
}).

-record(update_log_payload, {
    key :: key(),
    bucket :: bucket(),
    type :: type(),
    op :: op()
}).

-record(abort_log_payload, {}).

-record(prepare_log_payload, {prepare_time :: non_neg_integer()}).

-record(op_number, {
    node :: undefined | {node(), dcid()},
    global :: undefined | non_neg_integer(),
    local :: undefined | non_neg_integer()
}).
```

![](/files/-LteiKvmC_aHlLWNxF7Z)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://antidotedb.gitbook.io/documentation/architecture/log.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
