topology

package
v0.0.0-...-18f703b Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler implements topology operations

func NewHandler

func NewHandler(repo Repository) *Handler

NewHandler returns a new topology Handler

func (*Handler) Get

func (h *Handler) Get(response http.ResponseWriter, request *http.Request)

Get HTTP GET handler which returns the data-plane topology

func (*Handler) Set

func (h *Handler) Set(response http.ResponseWriter, request *http.Request)

Set HTTP POST handler which stores the data-plane topology

type Repository

type Repository interface {
	// FindAll returns all the topology objects from storage
	FindAll() ([]Topology, error)
	// Store stores a new topology object
	Store(t Topology) error
	// Update updates a topology
	Update(t Topology) error
	// DeleteAll deletes all the stored objects
	DeleteAll() error
	// Count counts the topology objects stored
	Count() (int64, error)
}

Repository defines the methods to be implemented by the storage layer.

func NewRepository

func NewRepository(c *mongo.Client) Repository

NewRepository returns a new mongo Repository

type Topology

type Topology struct {
	ID       primitive.ObjectID `json:"id" bson:"_id"`
	Hosts    []string           `json:"hosts" bson:"hosts"`
	Switches []string           `json:"switches" bson:"switches"`
	Links    []string           `json:"links" bson:"links"`
	DOT      string             `json:"dot" bson:"dot"`
	DOTImg   string             `json:"dot_img" bson:"dot_img"`
}

Topology represents a data-plane topology

Jump to

Keyboard shortcuts

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