> 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/blob/main/contributor/filesystem.md) 이며 식별자를 사용해 다운로드할 수 있습니다.

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

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

새 스냅샷이 *대체하면* 이전 것들(예: 여러 일별 스냅샷을 결합한 주별 스냅샷)을 대체하며, 해당 메타데이터는 어떤 이전 파일이 대체되었는지를 나타내므로 클라이언트가 이를 다운로드할 필요가 없습니다.

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

실습 [섹션의 작동하는 코드로 스냅샷을 실험해 볼 수 있습니다.](https://github.com/decentraland/docs/blob/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/blob/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 snapshot
```

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

| 필드                     | 값                                                                                                                        |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `entityId`             | 이 [엔티티를](https://github.com/decentraland/docs/blob/main/contributor/entities.md).                                        |
| `엔티티의 변경 불가능한 식별자입니다.` | 다음 중 하나입니다 `씬`, `프로필`, `wearable`, `emote`, `store` 또는 `outfits`.                                                        |
| `pointers`             | 다음의 배열입니다 [pointers](https://github.com/decentraland/docs/blob/main/contributor/pointers.md) 이 엔티티로 해석되는(또는 해석되었던) 포인터들. |
| `entityTimestamp`      | 이 엔티티가 업로드된 Unix UTC 타임스탬프(밀리초)입니다.                                                                                      |
| `authChain`            | 이 [인증 체인](https://github.com/decentraland/docs/blob/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/blob/main/contributor/entities.md) 각 [포인터](https://github.com/decentraland/docs/blob/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/blob/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 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://docs.decentraland.org/contributor/contributor-ko/content/snapshots.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.
