go-ipfs: github.com/ipfs/go-ipfs/commands Index | Files

package commands

import "github.com/ipfs/go-ipfs/commands"


Package Files

context.go reqlog.go

type Context Uses

type Context struct {
    ConfigRoot string
    ReqLog     *ReqLog

    Plugins *loader.PluginLoader

    LoadConfig func(path string) (*config.Config, error)

    Gateway bool

    ConstructNode func() (*core.IpfsNode, error)
    // contains filtered or unexported fields

Context represents request context

func (*Context) Close Uses

func (c *Context) Close()

Close cleans up the application state.

func (*Context) Context Uses

func (c *Context) Context() context.Context

Context returns the node's context.

func (*Context) GetAPI Uses

func (c *Context) GetAPI() (coreiface.CoreAPI, error)

GetAPI returns CoreAPI instance backed by ipfs node. It may construct the node with the provided function

func (*Context) GetConfig Uses

func (c *Context) GetConfig() (*config.Config, error)

GetConfig returns the config of the current Command execution context. It may load it with the provided function.

func (*Context) GetNode Uses

func (c *Context) GetNode() (*core.IpfsNode, error)

GetNode returns the node of the current Command execution context. It may construct it with the provided function.

func (*Context) LogRequest Uses

func (c *Context) LogRequest(req *cmds.Request) func()

LogRequest adds the passed request to the request log and returns a function that should be called when the request lifetime is over.

type ReqLog Uses

type ReqLog struct {
    Requests []*ReqLogEntry
    // contains filtered or unexported fields

ReqLog is a log of requests

func (*ReqLog) AddEntry Uses

func (rl *ReqLog) AddEntry(rle *ReqLogEntry)

AddEntry adds an entry to the log

func (*ReqLog) ClearInactive Uses

func (rl *ReqLog) ClearInactive()

ClearInactive removes stale entries

func (*ReqLog) Finish Uses

func (rl *ReqLog) Finish(rle *ReqLogEntry)

Finish marks an entry in the log as finished

func (*ReqLog) Report Uses

func (rl *ReqLog) Report() []*ReqLogEntry

Report generates a copy of all the entries in the requestlog

func (*ReqLog) SetKeepTime Uses

func (rl *ReqLog) SetKeepTime(t time.Duration)

SetKeepTime sets a duration after which an entry will be considered inactive

type ReqLogEntry Uses

type ReqLogEntry struct {
    StartTime time.Time
    EndTime   time.Time
    Active    bool
    Command   string
    Options   map[string]interface{}
    Args      []string
    ID        int
    // contains filtered or unexported fields

ReqLogEntry is an entry in the request log

func (*ReqLogEntry) Copy Uses

func (r *ReqLogEntry) Copy() *ReqLogEntry

Copy returns a copy of the ReqLogEntry

Package commands imports 13 packages (graph) and is imported by 620 packages. Updated 2019-08-31. Refresh now. Tools for package owners.