graph

package
v0.0.0-...-4e644ab Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LEVELDB_ENDPOINT = "./../ldb"
	INF              = 1e6
)
View Source
const (
	MODEL_UPDATE_PYTHON_PURPOSE_ID = 16
	MODEL_UPDATE_GOLANG_PURPOSE_ID = 17
)

Variables

This section is empty.

Functions

func AddModelUpdateEdge

func AddModelUpdateEdge(blockID string, graph Graph) (bool, error)

func GetClientID

func GetClientID(pubkey string, modelID string) (uint32, error)

func GetClientPubkey

func GetClientPubkey(id int, modelID string) (string, error)

func GetClients

func GetClients(modelID string) ([]string, error)

func GetModelUpdate

func GetModelUpdate(blockID string) (mupb.ModelUpdate, error)

func GetModelUpdates

func GetModelUpdates(modelID string) ([]*mupb.ModelUpdate, error)

func GetModelUpdatesBlockIDs

func GetModelUpdatesBlockIDs(modelID string) ([]string, error)

func RetrieveModelUpdate

func RetrieveModelUpdate(modelID string, blockID string) (*mupb.ModelUpdate, error)

func RunLiveFeed

func RunLiveFeed(wg *sync.WaitGroup)

func SaveModelUpdate

func SaveModelUpdate(blockID string, modelUpdate mupb.ModelUpdate) error

func SendModelUpdate

func SendModelUpdate(mupdate mupb.ModelUpdate) (string, error)

func StoreClientID

func StoreClientID(id uint32, pubkey string, modelID string) error

Types

type Block

type Block struct {
	Purpose uint32 `json:"purpose"`
	Data    []byte `json:"data"`
}

type Data

type Data struct {
	ID          string `json:"id,omitempty"`
	Value       int    `json:"value,omitempty"`
	PayloadType int    `json:"payload_type,omitempty"`
}

type GHResponse

type GHResponse struct {
	Type string `json:"type,omitempty"`
	Data Data   `json:"data,omitempty"`
}

type Graph

type Graph struct {
	ModelID string
	AdjList map[Node][]Node
}

func NewGraph

func NewGraph(modelID string) *Graph

func RetrieveDAGSnapshot

func RetrieveDAGSnapshot(modelID string) (Graph, error)

func (*Graph) AddEdge

func (graph *Graph) AddEdge(src Node, dst Node)

func (*Graph) AddNode

func (graph *Graph) AddNode(node Node)

func (*Graph) SaveDAGSnapshot

func (graph *Graph) SaveDAGSnapshot() error

func (*Graph) TopologicalSort

func (graph *Graph) TopologicalSort() []Node

type Model

type Model struct {
	ID      string
	Updates []string
}

type Node

type Node struct {
	BlockID string
}

type Peer

type Peer struct {
	Pubkey string `json:"pubkey"`
	ID     string `json:"id"`
	Name   string `json:"name"`
}

type Peers

type Peers struct {
	Peers []Peer `json:"peers"`
}

type Response

type Response struct {
	BlockID string `json:"blockID,omitempty"`
	Error   string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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