Naming blocks in the datastore

Đang mở
#242 16 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
20/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Lĩnh vực
distributed-systems

Hướng nghiên cứu

Bắt đầu bằng cách đọc các issue được liên kết của go-ipfs và js-ipfs, sau đó so sánh hành vi tra cứu datastore hiện tại của chúng đối với CIDv0 và CIDv1. Xem xét các đề xuất được liệt kê về multihash, CIDv1, chuyển hướng kép và metadata. Để được coi là hoàn tất, cần có một đặc tả về cách đặt tên datastore được thống nhất và một lộ trình migration; phạm vi triển khai chưa được xác định ở đây.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

P1

Context: https://github.com/ipfs/ipfs/issues/337

Currently, both js-ipfs and go-ipfs index blocks in the datastore by CID. Unfortunately, it's possible for a single block to have multiple CIDs due to (a) different CID versions and (b) due to different multicodecs (e.g., dag-cbor v. cbor v. raw).

The primary concern is (a). As we switch to returning CIDv1 (for multibase support), we still want to be able to lookup blocks that were fetched/added as CIDv0.

Currently, when looking up a CID, both go-ipfs and js-ipfs will first attempt to lookup the CID under the original CID version, then under the other CID version. However, this costs us two look-ups.


Primary use-case:

Ensure that CIDv1 and CIDv0 can be used interchangeably, especially in the gateway.

Proposals:

  1. Index blocks by multihash only.
  2. Index blocks by CIDv1.
  3. Double indirection. Map CIDs to a locally chosen hash function to blocks.
  4. Store extra metadata along with the block (known codecs, refcounts, etc.).
    • Unclear how to do this efficiently with a datastore (would likely require a bunch of separate writes/keys).

Desired properties:

  1. No duplicate blocks when...
    a. CID Versions differ: 1, 2 & 3
    b. CID Codecs differ: 1 & 3.
    c. Hash functions differ: 3.
  2. No discarded structural information (keep codecs): 2 & 3.
  3. Viable migration path: 1, 2 & 3.
  4. Fast migration path: 1 & 3.
  5. Zero Overhead:
    a. Time: 1, 2, & 4.
    b. Space: 1 & 2.

The current consensus is option 1 (multihash) (https://github.com/ipfs/go-ipfs/issues/6815, https://github.com/ipfs/js-ipfs/issues/2415). The proposal here is to consider option 2 (and at least look at the others).

However, option 1 doesn't give us property 2 as it discards the codec on write. @jbenet has objected strongly to this as we will be discarding structural information about the data. This information will still be stored in the pin set but we'll be losing this information for unpinned data.

We have also run into this same issue when trying to write a reverse datastore migration, migrating back from multihashes to CIDs: we need to somehow recover the codecs. The reverse migration in Option 2 would simply be: do nothing.

We need to consider the pros/cons of switching to option 1 before proceeding.


Side note: why should we even care about (b), multiple codecs for the same block?

IPLD objects as "files"

  • I might want to add one or more CBOR-IPLD objects to an IPFS directory for legacy applications, and address them in IPLD.
  • I might want to address a yaml/json object in an IPFS directory as an IPLD object.

Dumb block transport

I might want to take an unbalanced DAG (blockchain), a DAG with weird codecs (git, eth, etc.), etc. and sync it with another node. It would be nice if I could take this DAG, treat all the nodes as raw nodes, then build a well-balanced "overlay-dag" using simple, well-supported codecs.

This might, for example, be useful for storing DAGs with custom codecs in pinning services.

Ngôn ngữ chính
HTML
Star
1.2k
Fork
250
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ipfs/specs

Tất cả issue của ipfs/specs

Issue tương tự

Thêm issue về Distributed Systems

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.