storage

package
v0.0.0-...-020e20f Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package storage provides underlying storage implementation of CQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSN

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

DSN represents a sqlite connection string.

func NewDSN

func NewDSN(s string) (*DSN, error)

NewDSN parses the given string and returns a DSN.

func (*DSN) AddParam

func (dsn *DSN) AddParam(key, value string)

AddParam adds key:value pair DSN parameters.

func (*DSN) Clone

func (dsn *DSN) Clone() (copy *DSN)

Clone returns a copy of current dsn.

func (*DSN) Format

func (dsn *DSN) Format() string

Format formats DSN to a connection string.

func (*DSN) GetFileName

func (dsn *DSN) GetFileName() string

GetFileName gets the sqlite database file name of DSN.

func (*DSN) GetParam

func (dsn *DSN) GetParam(key string) (value string, ok bool)

GetParam gets the value.

func (*DSN) SetFileName

func (dsn *DSN) SetFileName(fn string)

SetFileName sets the sqlite database file name of DSN.

type ExecLog

type ExecLog struct {
	ConnectionID uint64
	SeqNo        uint64
	Timestamp    int64
	Queries      []Query
}

ExecLog represents the execution log of sqlite.

type ExecResult

type ExecResult struct {
	LastInsertID int64
	RowsAffected int64
}

ExecResult represents the execution result of sqlite.

type Query

type Query struct {
	Pattern string
	Args    []sql.NamedArg
}

Query represents the single query of sqlite.

type Storage

type Storage struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Storage represents a underlying storage implementation based on sqlite3.

func New

func New(dsn string) (st *Storage, err error)

New returns a new storage connected by dsn.

func (*Storage) Close

func (s *Storage) Close() (err error)

Close implements database safe close feature.

func (*Storage) Commit

func (s *Storage) Commit(ctx context.Context, wb twopc.WriteBatch) (result interface{}, err error)

Commit implements commit method of two-phase commit worker.

func (*Storage) Exec

func (s *Storage) Exec(ctx context.Context, queries []Query) (result ExecResult, err error)

Exec implements write query feature.

func (*Storage) Prepare

func (s *Storage) Prepare(ctx context.Context, wb twopc.WriteBatch) (err error)

Prepare implements prepare method of two-phase commit worker.

func (*Storage) Query

func (s *Storage) Query(ctx context.Context, queries []Query) (columns []string, types []string,
	data [][]interface{}, err error)

Query implements read-only query feature.

func (*Storage) Rollback

func (s *Storage) Rollback(ctx context.Context, wb twopc.WriteBatch) (err error)

Rollback implements rollback method of two-phase commit worker.

type TxID

type TxID struct {
	ConnectionID uint64
	SeqNo        uint64
	Timestamp    int64
}

TxID represents a transaction ID.

Jump to

Keyboard shortcuts

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