stargate

package
v0.0.0-...-7de2c07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BindnodeRegistry = bindnoderegistry.NewRegistry()

Functions

This section is empty.

Types

type AppResolver

type AppResolver interface {
	// GetResolver attempts to resolve starting from the given root. It returns a linksystem to load blocks from
	// and a resolver for the query
	GetResolver(ctx context.Context, root cid.Cid) (*ipld.LinkSystem, PathResolver, error)
}

AppResolver finds the root of a dag and returns an associated blockstore to use serving the request

type BlockMetadata

type BlockMetadata []BlockMetadatum

BlockMetadata is metadata for each "link" in the DAG being communicated, each block gets one of these and missing blocks also get one

type BlockMetadatum

type BlockMetadatum struct {
	Link   cid.Cid
	Status BlockStatus
}

BlockMetadatum is metadata for a single block

type BlockStatus

type BlockStatus string

BlockStatus indicates information about what is being done with a given block in a request

const (
	// BlockStatusPresent means the linked block was present on this machine, and is included
	// in this message
	BlockStatusPresent BlockStatus = "Present"
	// BlockStatusNotSent means the linked block was present on this machine, but not sent
	// - it needs to be fetched elsewhere
	BlockStatusNotSent BlockStatus = "NotSent"
	// BlockStatusMissing means I did not have the linked block, so I skipped over this part
	// of the traversal
	BlockStatusMissing BlockStatus = "Missing"
	// BlockStatusDuplicate means the linked block was encountered, but we already have traversed it
	// so we're not traversing it again -- the block has likely already been transmitted
	BlockStatusDuplicate BlockStatus = "Duplicate"
)

type DAG

type DAG struct {
	Ordering Ordering
	Blocks   BlockMetadata
}

Path is a StarGate message that provides information about resolution of the DAG at the end of a query

type ErrNoMoreMessages

type ErrNoMoreMessages struct{}

func (ErrNoMoreMessages) Error

func (e ErrNoMoreMessages) Error() string

type ErrNotFound

type ErrNotFound struct {
	Cid cid.Cid
}

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type ErrPathError

type ErrPathError struct {
	Cid  cid.Cid
	Path string
	Err  error
}

func (ErrPathError) Error

func (e ErrPathError) Error() string

func (ErrPathError) Unwrap

func (e ErrPathError) Unwrap() error

type Kind

type Kind string

Kind indicates whether a generic StarGate message is for a Path or a DAG

const (
	// KindPath indicates a pathing sequence
	KindPath Kind = "Path"
	// KindDAG indicates a DAG block
	KindDAG Kind = "DAG"
)

type Ordering

type Ordering string

Ordering is a traversal order for transmitting blocks

const (
	// OrderingDepthFirst indicates blocks will be transmitted depth first
	OrderingDepthFirst Ordering = "DepthFirst"
	// OrderingBreadthFirst indicates blocks will be breadth depth first
	OrderingBreadthFirst Ordering = "BreadthFirst"
)

type Path

type Path struct {
	// name of this path segment
	Segments []string
	// CIDs required, in order, to verify this segment of the path
	Blocks BlockMetadata
}

Path is a StarGate message that provides information about resolution of a path

type PathResolver

type PathResolver interface {
	// ResolvePathSegments attempts to resolve a path
	// On success, an implementation should:
	// - resolve at least one path segment
	// - return:
	//   - a valid stargate path message
	//   - any unresolved segments
	//   - a resolver operating whose root is at the end of the resolved portion of the path
	// On error, all values should be nil except the error value
	ResolvePathSegments(ctx context.Context, path PathSegments) (*Path, PathSegments, PathResolver, error)

	// ResolverQuery returns a resolver to fulfill the remaining portion of a request after path resolution with the
	// given query string.
	ResolveQuery(ctx context.Context, query Query) (QueryResolver, error)
}

PathResolver resolves the URL path

type PathSegments

type PathSegments []string

PathSegments are the path segments of a URL

type Query

type Query map[string][]string

Query is a URL query string to pass into stargate

type QueryResolver

type QueryResolver interface {
	// Next returns the next message
	Next() (*DAG, error)
	// done indicates where the query is fully resolved or there are more messages
	Done() bool
}

QueryResolver produces one or more stargate DAG messages to fulfill the request at the end of the path

type StarGateMessage

type StarGateMessage struct {
	Kind Kind
	Path *Path
	DAG  *DAG
}

StarGateMessage is a complete StarGate message ahead of a block sequence

Directories

Path Synopsis
Package blockwriter is not currently used, but it's useful code we may need
Package blockwriter is not currently used, but it's useful code we may need
Package handler implements the HTTP mechanics of sending StarGate responses
Package handler implements the HTTP mechanics of sending StarGate responses
sql

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL