store

package
v0.0.0-...-d465f1b Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetK

func GetK(datasourceID, timestamp uint64) ([32]byte, error)

GetK takes datasourceID and timestamp datasourceID and timestamp are used to create the storage key for the Keys collection Creates privKey if not found and then inserts new record in Keys collection Finally, returns privKey

func GetLastPublicationTimestamp

func GetLastPublicationTimestamp() (uint64, error)

GetLastPublicationTimestamp finds most recent timestamp for all publications This function is used to gather historical data in the event an Oracle is down and rebooted and datapoints are missing

func GetPublication

func GetPublication(rPoint [33]byte) (uint64, []byte, uint64, string, error)

GetPublication takes rPoint and returns value, signature, timestamp and name of publication if found

func GetPublicationByNameAndTimestamp

func GetPublicationByNameAndTimestamp(name string, timestamp uint64) (uint64, []byte, uint64, string, error)

GetPublicationByNameAndTimestamp takes name and timestamp and returns value, signature, timestamp and name of publication if found

func GetRPoint

func GetRPoint(datasourceID, timestamp uint64) ([33]byte, error)

GetRPoint takes datasourceID and timestamp and then creates and returns rPoint

func Init

func Init()

Init initializes connection to MongoDB and makes/retreives two collections "Keys" which contains publication index keys (from timestamp and publicationID) and private keys "Publications" which contains Value, Signature, Timestamp, and Name of publication

func IsPublished

func IsPublished(rPoint [33]byte) (bool, error)

IsPublished takes in rPoint and returns true, nil if published or false, nil if unpublished

func Publish

func Publish(rPoint [33]byte, value uint64, signature [32]byte, time uint64, name string) error

Publish takes in rPoint, value, signature, time and name and returns nil if successfully published

Types

type Key

type Key struct {
	PrivKey []byte
}

Key with private key

type Publication

type Publication struct {
	Value     uint64
	Signature []byte
	Timestamp uint64
	Name      string
}

Publication with Value, Signature, Timestamp, and Name of publication

func GetAllPublicationsByName

func GetAllPublicationsByName(name string) ([]*Publication, error)

GetAllPublicationsByName takes in a name string and returns all matching publications

Jump to

Keyboard shortcuts

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