mds

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRemoteInterfaceFactory

func RegisterRemoteInterfaceFactory(protocol string, factory RemoteInterfaceFactory)

func TimeSpansOverlap

func TimeSpansOverlap(t1 TimeSpan, t2 TimeSpan) bool

Types

type AUID

type AUID = common.AUID

type AvailabilitySpan

type AvailabilitySpan struct {
	FrameType int      `json:"frame"`
	Time      TimeSpan `json:"t"`
}

type BasicAvailability

type BasicAvailability struct {
	Existence    TimeSpan
	Availability []AvailabilitySpan
}

func (*BasicAvailability) MarshalJSON

func (ba *BasicAvailability) MarshalJSON() ([]byte, error)

func (*BasicAvailability) UnmarshalJSON

func (ba *BasicAvailability) UnmarshalJSON(data []byte) error

type BasicChannel

type BasicChannel = common.BasicChannel

type ChannelAndAvailability

type ChannelAndAvailability struct {
	Channel BasicChannel      `json:"c"`
	Avail   BasicAvailability `json:"a"`
	Local   bool              `json:"-"`
}

func (*ChannelAndAvailability) ExistsDuring

func (c *ChannelAndAvailability) ExistsDuring(span common.TimeSpan) bool

func (*ChannelAndAvailability) ExistsDuringGpsSecond

func (c *ChannelAndAvailability) ExistsDuringGpsSecond(second common.GpsSecond, fv *FrameView) bool

type ChannelHandler

type ChannelHandler = func(availability *ChannelAndAvailability)

type ChannelListHash

type ChannelListHash = string

type ChannelPredicate

type ChannelPredicate interface {
	Matches(channel *BasicChannel) bool
}

type ChannelView

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

A view into a list of channels

This is commonly used with the meta data store to view the channels or a subset of the channels. This acts as a read only view of a channel list.

func (*ChannelView) ApplyToChannelsIf

func (db *ChannelView) ApplyToChannelsIf(handler ChannelHandler, pred ChannelPredicate, span common.TimeSpan)

func (*ChannelView) ApplyToChannelsIfConstrained

func (db *ChannelView) ApplyToChannelsIfConstrained(handler ChannelHandler, pred ChannelPredicate, epoch common.TimeSpan)

func (*ChannelView) ResolveChannel

func (db *ChannelView) ResolveChannel(reference common.BasicChannel, epoch common.TimeSpan) (*ChannelAndAvailability, bool)

Given a reference channel find the best match in the channel database. The name must match, and any concretely specified attributes (rate, class, data type) must match. If the attributes are specified as masks (ie unknown) they match the attribute based on a bitwise check

type FrameExistence

type FrameExistence []TimeSpan

type FrameType

type FrameType struct {
	// Label, non-empty for frames from an external server
	FrameLabel string
	// base name of the frame type
	FrameName string
	// A combination of the label and frame type
	PrintName string
}

Describe a frame type

func NewFrameType

func NewFrameType(label, name string) FrameType

Create a new frame type, correcty constructing the PrintName field

type FrameTypeRegistrar

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

func CreateFrameTypeRegistrar

func CreateFrameTypeRegistrar() *FrameTypeRegistrar

func (*FrameTypeRegistrar) AddChannelListFile

func (fr *FrameTypeRegistrar) AddChannelListFile(fname string)

func (*FrameTypeRegistrar) AddChannelListFromReader

func (fr *FrameTypeRegistrar) AddChannelListFromReader(input io.Reader)

type FrameView

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

Get a view onto the frame database

func (*FrameView) Copy

func (fv *FrameView) Copy() FrameView

Create a deepish copy of the FrameView It keeps the same transactional spans

func (*FrameView) FrameExistance

func (fv *FrameView) FrameExistance(frameIndex int) []TimeSpan

func (*FrameView) FrameExistsAt

func (fv *FrameView) FrameExistsAt(frameIndex int, second common.GpsSecond) bool

func (*FrameView) FrameIndex

func (fv *FrameView) FrameIndex(frameType string) int

func (*FrameView) GetFrameType

func (fv *FrameView) GetFrameType(index int) (string, bool)

func (*FrameView) GetTransactionalSpan

func (fv *FrameView) GetTransactionalSpan(index int) (*TransactionalSpan, string, bool)

type GpsSecond

type GpsSecond = common.GpsSecond

type InternalJSONDB

type InternalJSONDB struct {
	Channels    []ChannelAndAvailability `json:"channels"`
	FrameTypes  map[string]int
	Frames      [][]JsonDBFrameInfo
	FrameSource string
}

type JsonDBFrameInfo

type JsonDBFrameInfo struct {
	FrameType string   `json:"frame_type"`
	TimeSpan  TimeSpan `json:"timespan"`
}

type MetaDataStore

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

to handle remote servers and combining channel lists we need a few things

  1. a list of remote servers
  2. Each server has a unique label that is added as a prefix to the frame type any channels available through a 'marked' frame type are thus marked as from an external server

func LoadDatabaseFromChannelLists

func LoadDatabaseFromChannelLists(channelLists []string, frameServer common.FrameServer) *MetaDataStore

func LoadDatabaseFromFrames

func LoadDatabaseFromFrames(framePath, jsonPath string) (*MetaDataStore, error)

func LoadDatabaseFromJsonDB

func LoadDatabaseFromJsonDB(path string) (*MetaDataStore, error)

func LoadDatabaseFromReplicationStream

func LoadDatabaseFromReplicationStream(reader io.Reader) (*MetaDataStore, error)

func (*MetaDataStore) AddRemote

func (db *MetaDataStore) AddRemote(remote RemoteDataStore) error

Add a remote server to data store. Remote servers have their channel lists combined with the local server

func (*MetaDataStore) DebugDump

func (db *MetaDataStore) DebugDump(dest io.Writer, maxDump int)

func (*MetaDataStore) FrameFileIntervals

func (db *MetaDataStore) FrameFileIntervals(frameType string, span common.TimeSpan) []common.TimeSpan

func (*MetaDataStore) FrameFilePaths

func (db *MetaDataStore) FrameFilePaths(frameType string, span common.TimeSpan) []string

func (*MetaDataStore) FrameView

func (mds *MetaDataStore) FrameView() *FrameView

func (*MetaDataStore) GetChannelView

func (db *MetaDataStore) GetChannelView(requiredPrefix string) ChannelView

func (*MetaDataStore) GetRemoteProxy

func (mds *MetaDataStore) GetRemoteProxy(prefix string) (RemoteProxyInterface, error)

func (*MetaDataStore) GetReplicationSummary

func (db *MetaDataStore) GetReplicationSummary() ReplicationHeader

func (*MetaDataStore) ReplicationStream

func (db *MetaDataStore) ReplicationStream(dest io.Writer, summaryRequest SummaryRequest) error

func (*MetaDataStore) SetExternalFrameServer

func (db *MetaDataStore) SetExternalFrameServer(server common.FrameServer)

func (*MetaDataStore) UpdateRemotes

func (db *MetaDataStore) UpdateRemotes() error

Query each registered remote server for updates and modify the channel/frame list as needed.

Currently errors stop progress

Note this process may take signifigant time and generate a fair amount of garbage for the GC.

This can (and should) be called periodically to keep the lists updated.

type RemoteDataStore

type RemoteDataStore struct {
	Label      string
	ConnString string
}

Describes a remote endpoint that the metadata store pools data with This is to allow the metadata server to consume and distribute metadata with a network of servers serving a global multi site set of data.

Note this is distinct from replication which is to simply mirror a server.

type RemoteInterface

type RemoteInterface interface {
	ReplicationSummary() (ReplicationHeader, error)
	ReplicationStream(summary SummaryRequest) (io.ReadCloser, error)
	RemoteProxyInterface
}

func GetRemoteInterface

func GetRemoteInterface(connStr string) (RemoteInterface, error)

type RemoteInterfaceFactory

type RemoteInterfaceFactory func(string) (RemoteInterface, error)

type RemoteProxyInterface

type RemoteProxyInterface interface {
	ProxyDataStream(frameType string, channels []string, span common.TimeSpan) (io.ReadCloser, error)
}

type ReplicationHeader

type ReplicationHeader struct {
	NumChannels     int      `json:"num_channels"`
	ChannelConfig   string   `json:"channel_hash"`
	FrameTypes      []string `json:"frame_types"`
	FrameSource     string   `json:"frame_source"`
	SkippedChannels bool     `json:"channels_omitted,omitempty"`
}

type ResolveChanEvaluator

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

func CreateResolveChanEvaluator

func CreateResolveChanEvaluator(reference common.BasicChannel, timespan common.TimeSpan) *ResolveChanEvaluator

func (*ResolveChanEvaluator) Match

func (*ResolveChanEvaluator) Process

func (rc *ResolveChanEvaluator) Process(chanAndAvail *ChannelAndAvailability)

type SummaryRequest

type SummaryRequest struct {
	ChannelConfigHash string                      `json:"channel_config"`
	FrameState        map[string]common.GpsSecond `json:"frame_state"`
}

Information used to make an optimized replication dumps. An unconfigured/empty struct denotes that everything should be dumped If the ChannelConfigHash is set, the channels are omitted if the metadata store channel config matches the given hash if the FrameState is specified, only updates passed those frame ranges are sent

type TimeSpan

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

func CombineTimeSpans

func CombineTimeSpans(t1 TimeSpan, t2 TimeSpan) TimeSpan

func CreateTimeSpan

func CreateTimeSpan(start GpsSecond, end GpsSecond) TimeSpan

func (*TimeSpan) Contains

func (ts *TimeSpan) Contains(second common.GpsSecond) bool

func (*TimeSpan) Empty

func (ts *TimeSpan) Empty() bool

func (*TimeSpan) End

func (ts *TimeSpan) End() GpsSecond

func (*TimeSpan) Extend

func (ts *TimeSpan) Extend(new_end GpsSecond)

func (*TimeSpan) MarshalJSON

func (ts *TimeSpan) MarshalJSON() ([]byte, error)

func (*TimeSpan) Start

func (ts *TimeSpan) Start() GpsSecond

func (*TimeSpan) ToCommon

func (ts *TimeSpan) ToCommon() common.TimeSpan

func (*TimeSpan) UnmarshalJSON

func (ts *TimeSpan) UnmarshalJSON(data []byte) error

type TransactionalSpan

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

func CreateTransactionalSpan

func CreateTransactionalSpan(input []common.TimeSpan) *TransactionalSpan

func (*TransactionalSpan) Read

func (ts *TransactionalSpan) Read() FrameExistence

func (*TransactionalSpan) Write

func (ts *TransactionalSpan) Write(updater WriteOperation)

type WriteOperation

type WriteOperation func(FrameExistence) FrameExistence

Jump to

Keyboard shortcuts

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