New Unixfs implementations

Abierto
#224 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
go

Línea de trabajo

Comienza revisando la capa intermedia propuesta blocks.Block y los formatos unixfs.proto y dag-pb.proto; después, sigue cómo se representaría un flujo CAR ordenado basado en io.Reader. El issue enumera varias implementaciones posibles, pero no menciona archivos ni pruebas del repositorio, por lo que hay que acordar el alcance y los criterios de finalización antes de empezar el trabajo.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Dedicated unixfs implementations are often much more performant and efficient.
See for example two of mines:

I think it is more sustainable to maintain a handful of dedicated implementations that individually do one job well (something like feather and something that would maintain state to support unordered dags are really different).

Unified middle layer

The way I have been writing my implementations is by jugling bytes unixfs.proto and dag-pb.proto by hand everywhere.
This is kinda meh looking because of all the little details that have to be checked.

I really think we need some efficient middle layer that takes in blocks.Block parse them, do sanity checks and return some representation that looks like internal unixfs (so one node per block, and full support for all schenanigans you would want to do but with error checking):

package unixfs

type Type uint8

const (
  _ Type = iota
  Directory
  File
  Metadata
  Symlink
  HAMTShard
)

type Node struct{
  Type Type
  Data []byte // for files
  Entries []Entry
  DagSize uint64
  HashType uint64 // for HAMT dirs
  Fanout uint64 // for HAMT dirs
}

type Entry struct{
  Link
  Name string // for directories
}

type Link struct{
  Type Type // Indicative, not actually
  Cid cid.Cid
  FileSize uint64 // for files
  DagSize uint64
}

func (*Node) UnmarshalIPFS(blocks.Block) error
func (*Node) MarshalIPFS() (blocks.Block, error)

func (*Node) Encode() (Link, blocks.Block, error)

// File operations
func (*Node) ParseFile(Link, blocks.Block) error
func (*Node) AddFileSegments(Link...) error
func (*Node) FileSize() uint64

// Directory operations
func (*Node) ParseDirectory(Link, blocks.Block) error
func (*Node) AddChildrenNode(Link...) error

// other types ...

This would not includes helper functions for more advanced stuff like HAMT, chunking, ... we will most likely need thoses too but the goal here is to provide a thin wrapper around the protobuf that add the repetitive input validation.

Impls

List of implementations we need:

  • Efficient state-light streaming decoder with incremental verification. (I'll probably use feather after refactoring it to use the unified lower layer and adding the missing features)
    The goal is to incremental verify ordered .car files from saturn on the cheap resource wise. (and other ordered blocks sources)
    • Capable of streaming the verification of an ordered stream of block (such as a car file red from io.Reader) incrementally (while streaming the result out).
    • Interface must implement io.Reader for reading from files without any background goroutine (efficiency).
    • It must support incrementally verifying requests mapping to https://github.com/ipfs/boxo/pull/176 sementics.
  • Decoder with incremental verification and output stream with random walk BFS input.
    • Streaming data in order can have a high cost, however if we are cleaver we can use .WriteAt to write blocks in any order as long as we receive roots before leaves (or cache leaves but then incremental verification is not possible)
  • MFS rewrite.
  • Some write opperation helpers (concatenate, chunking, ...)
  • ... ?
Lenguaje dominante
Go
Estrellas
326
Forks
165
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ipfs/boxo

Todos los issues de ipfs/boxo

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.