index.go 1.13 KB
Newer Older
tavit ohanian's avatar
tavit ohanian committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
package iface

import (
	"context"
	//	"io"

	options "gitlab.dms3.io/dms3/interface-go-dms3-core/options"
	corepath "gitlab.dms3.io/dms3/interface-go-dms3-core/path"
	path "gitlab.dms3.io/dms3/interface-go-dms3-core/path"
	//	dms3ld "gitlab.dms3.io/dms3/go-ld-format"
)

// IndexMakeEvent modeled after Unixfs AddEvent
type IndexMakeEvent struct {
	Name  string
	Path  path.Resolved `json:",omitempty"`
	Bytes int64         `json:",omitempty"`
	Size  string        `json:",omitempty"`
}

// RepoList interface {
type RepoList interface {
	// Name returns repository name
	Name() string
	// Id returns repository path
	Id() string
}

//type RepoList []RepoEntry

// IndexAPI is the basic interface to immutable files in DMS3
type IndexAPI interface {
	// Add imports the data from the reader into merkledag file
	//Add(context.Context, io.Reader) (ResolvedPath, error)

	// Cat returns a reader for the file
	//Cat(context.Context, Path) (Reader, error)
	Index(ctx context.Context, path corepath.Path, opts ...options.IndexListOption) (RepoList, error)

	// Ls returns the list of links in a directory
	//Ls(context.Context, Path) ([]*dms3ld.Link, error)
}