adminserver

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation

Overview

Package adminserver provides a HTTP server that allows to perform administrative operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnounceRes

type AnnounceRes struct {
	// The CID of the advertisement announced as latest.
	AdvId cid.Cid `json:"adv_id"`
}

func (*AnnounceRes) ReadFrom

func (er *AnnounceRes) ReadFrom(r io.Reader) (int64, error)

func (*AnnounceRes) WriteTo

func (er *AnnounceRes) WriteTo(w io.Writer) (int64, error)

type ConnectReq

type ConnectReq struct {
	Maddr string `json:"maddr"`
}

ConnectReq request to connect to a given multiaddr.

func (*ConnectReq) ReadFrom

func (er *ConnectReq) ReadFrom(r io.Reader) (int64, error)

func (*ConnectReq) WriteTo

func (er *ConnectReq) WriteTo(w io.Writer) (int64, error)

type ConnectRes

type ConnectRes struct {
}

ConnectRes represents successful response to ConnectReq request.

func (*ConnectRes) ReadFrom

func (er *ConnectRes) ReadFrom(r io.Reader) (int64, error)

func (*ConnectRes) WriteTo

func (er *ConnectRes) WriteTo(w io.Writer) (int64, error)

type ImportCarReq

type ImportCarReq struct {
	// The path to the CAR file
	Path string `json:"path"`
	// The optional key associated to the CAR. If not provided, one will be generated.
	Key []byte `json:"key"`
	// The optional metadata.
	Metadata []byte `json:"metadata"`
}

ImportCarReq represents a request for importing a CAR file.

func (*ImportCarReq) ReadFrom

func (er *ImportCarReq) ReadFrom(r io.Reader) (int64, error)

func (*ImportCarReq) WriteTo

func (er *ImportCarReq) WriteTo(w io.Writer) (int64, error)

type ImportCarRes

type ImportCarRes struct {
	// The lookup Key associated to the imported CAR.
	Key []byte `json:"key"`
	// The CID of the advertisement generated as a result of import.
	AdvId cid.Cid `json:"adv_id"`
}

ImportCarRes represents the response to an ImportCarReq.

func (*ImportCarRes) ReadFrom

func (er *ImportCarRes) ReadFrom(r io.Reader) (int64, error)

func (*ImportCarRes) WriteTo

func (er *ImportCarRes) WriteTo(w io.Writer) (int64, error)

type ListCarRes

type ListCarRes struct {
	// The path of CARs imported.
	Paths []string `json:"paths"`
}

ListCarRes represents the response to list cars.

func (*ListCarRes) ReadFrom

func (er *ListCarRes) ReadFrom(r io.Reader) (int64, error)

func (*ListCarRes) WriteTo

func (er *ListCarRes) WriteTo(w io.Writer) (int64, error)

type Option

type Option func(*options) error

Option captures a configurable parameter in admin HTTP server.

func WithListenAddr

func WithListenAddr(addr string) Option

WithListenAddr sets the net address on which the admin HTTP server is exposed. If uset, the default address of '0.0.0.0:3102' is used.

func WithReadTimeout

func WithReadTimeout(t time.Duration) Option

WithReadTimeout set s the HTTP read timeout. If unset, the default of 30 seconds is used.

func WithWriteTimeout

func WithWriteTimeout(t time.Duration) Option

WithWriteTimeout set s the HTTP write timeout. If unset, the default of 30 seconds is used.

type RemoveCarReq

type RemoveCarReq struct {
	// The key associated to the CAR.
	Key []byte `json:"key"`
}

RemoveCarReq represents a request for removing a CAR file.

func (*RemoveCarReq) ReadFrom

func (er *RemoveCarReq) ReadFrom(r io.Reader) (int64, error)

func (*RemoveCarReq) WriteTo

func (er *RemoveCarReq) WriteTo(w io.Writer) (int64, error)

type RemoveCarRes

type RemoveCarRes struct {
	// The CID of the advertisement generated as a result of removal.
	AdvId cid.Cid `json:"adv_id"`
}

RemoveCarRes represents the response to a RemoveCarReq

func (*RemoveCarRes) ReadFrom

func (er *RemoveCarRes) ReadFrom(r io.Reader) (int64, error)

func (*RemoveCarRes) WriteTo

func (er *RemoveCarRes) WriteTo(w io.Writer) (int64, error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(h host.Host, e *engine.Engine, cs *supplier.CarSupplier, o ...Option) (*Server, error)

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start() error

Jump to

Keyboard shortcuts

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