mysqlbackend

package
v0.0.0-...-726f7ef Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLStateBackend

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

MySQLStateBackend implements the libqpu.QPUState interface using MySQL as a backend store.

func NewStateBackend

func NewStateBackend(conf *libqpu.QPUConfig) (*MySQLStateBackend, error)

NewStateBackend initiated a connection with the MySQL specified in the QPU's configuration, and creates an instance of libqpu.QPUState.

func (*MySQLStateBackend) Cleanup

func (s *MySQLStateBackend) Cleanup()

Cleanup closes the connection to the MySQL instance

func (*MySQLStateBackend) Get

func (s *MySQLStateBackend) Get(from string, projection []string, where []string, orderby string, limit int64, parentSpan opentracing.Span) (<-chan map[string]interface{}, error)

Get retrieves state records based on a given query. It returns a channel that can be used to iteratively return the retrieved records. The channel returns records of type map[<attributeName>]<string_value>.

func (*MySQLStateBackend) GetRow

func (s *MySQLStateBackend) GetRow(from string, projection []string, where []string, parentSpan opentracing.Span) *sql.Row

GetRow ...

func (*MySQLStateBackend) Init

func (s *MySQLStateBackend) Init(database, table, createTable string) error

Init performs the necessary initializations for using the MySQL instance as a store for the QPU's state. In more detail:

  • it creates a database if it does not exist, selects it (USE)
  • and creates the table to be used for storing the state (it drops the table if it already exists)

func (*MySQLStateBackend) Insert

func (s *MySQLStateBackend) Insert(table string, row map[string]interface{}, vc map[string]*timestamp.Timestamp) error

Insert inserts a record in the state.

func (*MySQLStateBackend) LogReceivedUpdateRec

func (s *MySQLStateBackend) LogReceivedUpdateRec(rowIDVal interface{}, vc map[string]*timestamp.Timestamp, tsLocal time.Time)

LogReceivedUpdateRec ...

func (*MySQLStateBackend) Update

func (s *MySQLStateBackend) Update(table string, predicate, newValues map[string]interface{}, vc map[string]*timestamp.Timestamp) error

Update updates a state record.

Jump to

Keyboard shortcuts

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