nodeinfo

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Code generated by counterfeiter. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var OakVersion = "latest"

OakVersion contains the version of the Oak build.

Functions

This section is empty.

Types

type Handler

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

Handler implements the /nodeinfo REST endpoint.

func NewHandler

func NewHandler(version Version, retriever nodeInfoRetriever) *Handler

NewHandler returns the /nodeinfo REST handler. If logger is nil, then a default will be used.

func (*Handler) Handler

func (h *Handler) Handler() common.HTTPRequestHandler

Handler returns the HTTP REST handle for the NodeInfo handler.

func (*Handler) Method

func (h *Handler) Method() string

Method returns the HTTP REST method for the NodeInfo handler.

func (*Handler) Path

func (h *Handler) Path() string

Path returns the HTTP REST endpoint for the NodeInfo handler.

type NodeInfo

type NodeInfo struct {
	Version           string                 `json:"version"`
	Software          Software               `json:"software"`
	Protocols         []string               `json:"protocols"`
	Services          Services               `json:"services"`
	OpenRegistrations bool                   `json:"openRegistrations"`
	Usage             Usage                  `json:"usage"`
	Metadata          map[string]interface{} `json:"metadata,omitempty"`
}

NodeInfo contains NodeInfo data.

type NodeInfoRetriever

type NodeInfoRetriever struct {
	GetNodeInfoStub func(version Version) *NodeInfo
	// contains filtered or unexported fields
}

func (*NodeInfoRetriever) GetNodeInfo

func (fake *NodeInfoRetriever) GetNodeInfo(version Version) *NodeInfo

func (*NodeInfoRetriever) GetNodeInfoArgsForCall

func (fake *NodeInfoRetriever) GetNodeInfoArgsForCall(i int) Version

func (*NodeInfoRetriever) GetNodeInfoCallCount

func (fake *NodeInfoRetriever) GetNodeInfoCallCount() int

func (*NodeInfoRetriever) GetNodeInfoReturns

func (fake *NodeInfoRetriever) GetNodeInfoReturns(result1 *NodeInfo)

func (*NodeInfoRetriever) GetNodeInfoReturnsOnCall

func (fake *NodeInfoRetriever) GetNodeInfoReturnsOnCall(i int, result1 *NodeInfo)

func (*NodeInfoRetriever) Invocations

func (fake *NodeInfoRetriever) Invocations() map[string][][]interface{}

type Service

type Service struct {
	*lifecycle.Lifecycle
	// contains filtered or unexported fields
}

Service periodically polls various Oak services and produces NodeInfo data.

func NewService

func NewService(serviceIRI *url.URL, refreshInterval time.Duration, apStore apstore.Store,
	multipleTagQueryCapable bool) *Service

NewService returns a new NodeInfo service. If this Oak server uses a storage provider that can do queries using 2 tags, then we can take advantage of a feature in the underlying Aries storage provider to update the stats more efficiently. If logger is nil, then a default will be used.

func (*Service) GetNodeInfo

func (r *Service) GetNodeInfo(version Version) *NodeInfo

GetNodeInfo returns a NodeInfo struct compatible with the given version.

type Services

type Services struct {
	Inbound  []string `json:"inbound"`
	Outbound []string `json:"outbound"`
}

Services contains services. (Currently Oak does not use this object.)

type Software

type Software struct {
	Name       string `json:"name"`
	Version    string `json:"version"`
	Repository string `json:"repository,omitempty"`
}

Software contains information about the Oak application, including version.

type Usage

type Usage struct {
	Users         Users `json:"users"`
	LocalPosts    int   `json:"localPosts"`
	LocalComments int   `json:"localComments"`
}

Usage contains usage statistics, including the number of 'Create' and 'Like' activities were issued by this node.

type Users

type Users struct {
	Total int `json:"total"`
}

Users contains the number of users. (Currently always 1.)

type Version

type Version = string

Version specified the version of the NodeInfo data.

const (
	// V2_0 is NodeInfo version 2.0 (http://nodeinfo.diaspora.software/ns/schema/2.0#).
	V2_0 Version = "2.0"

	// V2_1 is NodeInfo version 2.1 (http://nodeinfo.diaspora.software/ns/schema/2.1#).
	V2_1 Version = "2.1"
)

Jump to

Keyboard shortcuts

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