> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/contributor/contributor-ko/content/snapshots.md).

# 스냅샷

콘텐츠 서버는 자신이 호스팅하는 활성 엔티티의 요약을 주기적으로 컴파일하는데, 이를 *스냅샷*. 이는 일반적인 [파일이며](https://github.com/decentraland/docs/tree/main/contributor/filesystem.md) 식별자를 사용해 다운로드할 수 있습니다.

스냅샷은 일간, 주간, 월간, 연간 기준으로 생성됩니다. 각 스냅샷에는 해당 범위에서 이전 스냅샷 이후 변경된 활성 엔티티 집합이 포함됩니다.

스냅샷에는 동일한 엔티티의 충돌하는 버전(즉, 서로 다른 [manifest 파일](https://github.com/decentraland/docs/tree/main/contributor/entities.md#properties) 이 같은 포인터에 연결된 버전)이 업데이트되면서 포함될 수 있습니다. 이를 스캔할 때 클라이언트는 가장 최근 스냅샷의 버전을 유지해야 합니다. 콘텐츠 서버는 비활성 파일을 삭제할 수 있으므로, 오래된 엔티티 버전은 다운로드 가능하다고 보장되지 않습니다.

새 스냅샷이 *이전 것들을 대체할 때* 메타데이터에는 어떤 이전 파일이 대체되는지 표시되므로 클라이언트가 이를 다운로드할 필요가 없습니다.

사용 가능한 모든 스냅샷을 결합하고(이에 대한 자세한 내용은 아래 참조), 그 과정에서 발견되는 각 [포인터에 대해](https://github.com/decentraland/docs/tree/main/contributor/pointers.md) 가장 최근의 엔티티를 유지하면 활성 엔티티의 전체 집합을 찾을 수 있습니다.

실제 동작하는 코드를 통해 스냅샷을 실습해 볼 수 있습니다. [실습](https://github.com/decentraland/docs/tree/main/contributor/practice.md) 섹션에서.

### 스냅샷 찾기 <a href="#discover" id="discover"></a>

현재 스냅샷 집합을 찾으려면 [`스냅샷` 엔드포인트를](https://decentraland.github.io/catalyst-api-specs/#tag/Content-Server/operation/getSnapshots)사용하세요. 응답에는 다음 필드를 가진 항목 배열이 포함됩니다:

| 필드                        | 값                                                                                     |
| ------------------------- | ------------------------------------------------------------------------------------- |
| `generationTimestamp`     | 이 스냅샷이 생성된 Unix UTC 타임스탬프입니다.                                                         |
| `hash`                    | 이 스냅샷 [파일](https://github.com/decentraland/docs/tree/main/contributor/filesystem.md). |
| `numberOfEntities`        | 스냅샷 파일의 항목 수입니다.                                                                      |
| `replacedSnapshotHashes`  | 다음 배열입니다 `hash` 이 스냅샷으로 대체된 스냅샷들의                                                     |
| `timeRange.initTimestamp` | 스냅샷 범위의 시작 시점에 대한 Unix UTC 타임스탬프(밀리초)입니다.                                             |
| `timerange.endTimestamp`  | 스냅샷 범위의 종료 시점에 대한 Unix UTC 타임스탬프(밀리초)입니다.                                             |

예를 들면:

```json
{
  "generationTimestamp": 1684979298844,
  "hash": "bafybeiflmm46nr4vv2h3wuzbx3pukcz7ju4fhbfzt6yxmoo533uktlgru4",
  "numberOfEntities": 12345,
  "replacedSnapshotHashes": [ "bafybeicw6x75ieaxfwynekbyhpcsgctpjkt6cb4j6oa7s57qjj6e4b5phd" ],
  "timeRange": {
     "initTimestamp": 1684281600000,
     "endTimestamp": 1684886400000
  }
}
```

### 스냅샷 다운로드 <a href="#download" id="download"></a>

다음을 사용하여 `hash` 스냅샷의 필드를 사용하면, 클라이언트는 해당 시간 범위에 생성되거나 업데이트된 관련 포함 엔티티를 다운로드할 수 있습니다.

스냅샷 파일은 이 정확한 줄로 시작합니다:

```
### Decentraland JSON 스냅샷
```

그다음 각 줄은 다음의 [엔티티를](https://github.com/decentraland/docs/tree/main/contributor/entities.md) 설명하는 JSON 문서입니다:

| 필드                | 값                                                                                                                    |
| ----------------- | -------------------------------------------------------------------------------------------------------------------- |
| `entityId`        | 이것의 변경 불가능한 식별자 [엔티티를](https://github.com/decentraland/docs/tree/main/contributor/entities.md).                      |
| `entityType`      | 다음 중 하나 `씬`, `프로필`, `wearable`, `emote`, `store` 또는 `outfits`.                                                       |
| `pointers`        | 다음의 배열 [pointers](https://github.com/decentraland/docs/tree/main/contributor/pointers.md) 이 엔티티로 해석되는(또는 해석되던) 것입니다. |
| `entityTimestamp` | 이 엔티티가 업로드된 시점의 Unix UTC 타임스탬프(밀리초)입니다.                                                                              |
| `authChain`       | 그 [인증 체인](https://github.com/decentraland/docs/tree/main/contributor/entities.md#ownership) 이 엔티티에 대한 것입니다.          |

일반적인 항목은 다음과 같습니다:

```json
{
  "entityId": "bafkreigrvaqynmiglpvewwhn2yd63q5dvagrrt5jbhimzvbrn5kimj5zne",
  "entityType": "wearable",
  "pointers": ["urn:decentraland:matic:collections-v2:0x11a6879861f36cbad632a4e7226816a16139fb33:0"],
  "entityTimestamp": 1671117456129,
  "authChain": [
    // ... 인증 체인 페이로드 및 서명
  ]
}
```

{% hint style="info" %}
스냅샷을 줄 단위로 파싱하려는 경우, 헤더가 있는 첫 번째 줄은 건너뛰거나(더 나아가 검증하고), 파일 끝의 빈 줄을 처리할 준비를 해 두어야 합니다.
{% endhint %}

#### 엔티티 인덱스 시작하기 <a href="#index-start" id="index-start"></a>

전체 활성 엔티티 집합을 인덱싱하려는 클라이언트는 현재 사용 가능한 모든 스냅샷을 처리하고, 가장 최근의 [엔티티를](https://github.com/decentraland/docs/tree/main/contributor/entities.md) 각각에 대해 [포인터에 대해](https://github.com/decentraland/docs/tree/main/contributor/pointers.md).

가장 간단한 전략은 스냅샷을 역시간순(즉, 최신 것부터)으로 처리하면서 이미 발견된 포인터는 무시해 각 포인터에 대해 최신 엔티티 참조를 유지하는 것입니다.

의사 코드로:

```py
# 현재 스냅샷 집합을 다운로드하고, 최신 것부터 오래된 것 순으로 정렬합니다:
snapshots = get_snapshots()
snapshots.sort('timeRange.initTimestamp', DESCENDING)

seen_pointers = set()

# 각 포인터에 대해 가장 최신 엔티티를 유지하면서 스냅샷을 처리합니다:
for snapshot in snapshots:
    items = get_snapshot_items(snapshot) 

    for item in items:
        if any(pointer in seen_pointers for pointer in item.pointers):
            discard(item)
        else:
            keep(item)
            seen_pointers.update(item.pointers)
```

개별 엔티티는 여러 포인터로 참조될 수 있으며(이는 보통 [장면들](/contributor/contributor-ko/content/entity-types/scenes.md)), 항목을 유지할지 버릴지 결정하기 전에 모두 확인해야 합니다.

{% hint style="info" %}
더 긴 시간 범위의 스냅샷 파일은 매우 클 수 있습니다. 전체 엔티티 집합을 인덱싱할 필요가 없는 개발 및 실험 목적이라면 더 작은 스냅샷을 사용하는 것이 좋습니다. 결과적으로 생성되는 엔티티 집합은 불완전하지만 유효합니다.
{% endhint %}

#### 엔티티 인덱스 업데이트하기 <a href="#index-update" id="index-update"></a>

최신 엔티티 인덱스를 유지하는 클라이언트는 주기적으로 [`스냅샷`](https://decentraland.github.io/catalyst-api-specs/#tag/Content-Server/operation/getSnapshots) 엔드포인트를 호출하고, 다음을 고려하여 각 파일을 다운로드할지 여부를 판단할 수 있습니다:

* 다음으로 식별된 스냅샷이 `hash` 이미 다운로드되었나요?
* 해당 항목이 `hash` 다른 스냅샷의 `replacedSnapshotHashes` 목록에 이미 다운로드된 스냅샷이 있는가?
* 해당 `timeRange` 현재 목적에 적합한가요?

처리해야 할 새 스냅샷이 있다면, 위와 동일한 전략을 사용해 기존 데이터셋을 업데이트할 수 있습니다.

### 예시

다음 [실습](https://github.com/decentraland/docs/tree/main/contributor/practice.md) 섹션에서는 스냅샷 시스템과 함께 작동하는 코드 예제를 찾을 수 있습니다.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/contributor/contributor-ko/content/snapshots.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
