commonlib

package module
v0.0.0-...-2867bd2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MPL-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFreePort

func GetFreePort() (port int, err error)

func IsIpv6

func IsIpv6(ip string) bool

check if an ip address is IPV6

func SetGridValue

func SetGridValue(gV grid.Grid_Value, val interface{}) error

Types

type AggregationPart

type AggregationPart struct {
	OriginalValue     interface{} // valid types are int64, float64, bool, uint64
	RowColTuple       RowCol
	AreaWeight        float64
	InterpolatedValue float64
}

type ConnError

type ConnError struct {
	Out chan<- error
	Msg chan<- string
}

func (*ConnError) Debug

func (cerr *ConnError) Debug(message string, args ...any)

Logger interface

func (*ConnError) Error

func (cerr *ConnError) Error(message string, args ...any)

func (*ConnError) Info

func (cerr *ConnError) Info(message string, args ...any)

func (*ConnError) Warn

func (cerr *ConnError) Warn(message string, args ...any)

type ConnectionManager

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

func NewConnectionManager

func NewConnectionManager() *ConnectionManager

func (*ConnectionManager) Run

func (cm *ConnectionManager) Run()

run the connection manager

func (*ConnectionManager) TryConnect

func (cm *ConnectionManager) TryConnect(sr string, retry_count int, retry_secs int, print_retry_msgs bool) (*capnp.Client, error)

type DeleteMsg

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

type Grid

type Grid struct {
	GridResolution       Resolution
	GridUnit             string
	NumRows              uint64
	NumCols              uint64
	NoDataType           interface{} // valid types are int64, float64, bool, uint64
	Bounds               LatLonBoundaries
	BoundsFromCellCenter LatLonBoundaries

	// functions that need to be implemented to use the grid capnp interface
	RowColToLatLon           func(row, col uint64) (LatLon, error)
	GetValueRowCol           func(row, col uint64) (interface{}, error)
	GetValueLatLon           func(lat, lon float64) (interface{}, RowCol, RowCol, error)
	GetValueRowColAggregated func(row, col uint64, resolution Resolution, agg string, includeAggParts bool) (interface{}, []*AggregationPart, error)
	GetValueLatLonAggregated func(lat, lon float64, resolution Resolution, agg string, includeAggParts bool) (interface{}, []*AggregationPart, error)
	// contains filtered or unexported fields
}

Grid is a struct that implements the Grid_Server interface for immutable grids, the functions that need to be implemented are GetValueRowCol, GetValueLatLon GetValueRowColAggregated, GetValueLatLonAggregated not thread safe if the grid below is changing

func NewGrid

func NewGrid(restorer *Restorer, id, name, description string) *Grid

func (*Grid) ClosestValueAt

func (g *Grid) ClosestValueAt(c context.Context, call grid.Grid_closestValueAt) error

Grid_Server interface

func (*Grid) Dimension

func (g *Grid) Dimension(c context.Context, call grid.Grid_dimension) error

func (*Grid) Info

func (g *Grid) Info(c context.Context, call common.Identifiable_info) error

Identifiable_Server interface

func (*Grid) InitialSturdyRef

func (g *Grid) InitialSturdyRef() (*SturdyRef, error)

func (Grid) IsComparable

func (g Grid) IsComparable(r Resolution) bool

func (*Grid) LatLonBounds

func (g *Grid) LatLonBounds(c context.Context, call grid.Grid_latLonBounds) error

func (*Grid) NoDataValue

func (g *Grid) NoDataValue(c context.Context, call grid.Grid_noDataValue) error

func (*Grid) Resolution

func (g *Grid) Resolution(c context.Context, call grid.Grid_resolution) error

func (*Grid) Save

Persistence_Server interface

func (*Grid) StreamCells

func (g *Grid) StreamCells(c context.Context, call grid.Grid_streamCells) error

func (*Grid) Unit

func (g *Grid) Unit(c context.Context, call grid.Grid_unit) error

func (*Grid) ValueAt

func (g *Grid) ValueAt(c context.Context, call grid.Grid_valueAt) error

type Identifiable

type Identifiable struct {
	Id          string // uuid
	Name        string
	Description string
}

func (*Identifiable) Info

type LatLon

type LatLon struct {
	Lat float64
	Lon float64
}

type LatLonBoundaries

type LatLonBoundaries struct {
	TopLeft     LatLon
	TopRight    LatLon
	BottomLeft  LatLon
	BottomRight LatLon
}

type Persistable

type Persistable struct {

	//function to create a capability of the object
	Cap func() capnp.Client
	// contains filtered or unexported fields
}

func (*Persistable) Save

Persistent_Server interface

type ReleaseSturdyRefAction

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

ReleaseSturdyRefAction

func NewAction

func NewAction(doSave chan *SaveMsg, doAction func() error) *ReleaseSturdyRefAction

func (*ReleaseSturdyRefAction) ReleaseSR

ReleaseSturdyRef_Server interface

func (*ReleaseSturdyRefAction) Save

type Resolution

type Resolution struct {
	Value interface{}
}

func (Resolution) Compare

func (r Resolution) Compare(other Resolution) int

Compare compares two resolutions 1 means r is bigger than other -1 means r is smaller than other 0 means r is equal to other

type RestoreAnswer

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

type RestoreMsg

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

type Restorer

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

func NewRestorer

func NewRestorer(hostname string, port uint16) *Restorer

NewRestorer creates a new Restorer

func (*Restorer) BootstrapSturdyRef

func (r *Restorer) BootstrapSturdyRef() *SturdyRef

func (*Restorer) Host

func (r *Restorer) Host() string

func (*Restorer) Port

func (r *Restorer) Port() uint16

func (*Restorer) Restore

Restorer_Server interface

type RowCol

type RowCol struct {
	Row uint64
	Col uint64
}

type SaveAnswer

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

type SaveMsg

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

type StreamingCallback

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

func (*StreamingCallback) SendCells

type SturdyRef

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

func NewSturdyRef

func NewSturdyRef(vatIds []uint64, host string, port uint16, srToken string) *SturdyRef

func NewSturdyRefByString

func NewSturdyRefByString(sturdyRef string) (*SturdyRef, error)

func (*SturdyRef) String

func (sr *SturdyRef) String() string

type SturdyRefToken

type SturdyRefToken string

Jump to

Keyboard shortcuts

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