generic

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdmissionControlPolicy

type AdmissionControlPolicy interface {
	// Admit checks whether the query should be admitted.
	// If the query is not admitted, a non-nil error is returned with the reason why the query was denied.
	// If the query is admitted, then the error will be nil and a callback function is returned to the caller.
	// The caller must execute it after finishing the query
	Admit(ctx context.Context, txName string) (callOnFinish func(), err error)
}

AdmissionControlPolicy interface defines the admission policy contract.

func NewAdmissionControlPolicy

func NewAdmissionControlPolicy(policyName string, onlyWriteQueries bool, limitMaxConcurrentTxn int64) AdmissionControlPolicy

type ErrCode

type ErrCode func(error) string

type ErrRetry

type ErrRetry func(error) bool

type Generic

type Generic struct {
	sync.Mutex

	LockWrites     bool
	LastInsertID   bool
	DB             *sql.DB
	GetCurrentSQL  string
	GetRevisionSQL string

	RevisionSQL          string
	ListRevisionStartSQL string
	GetRevisionAfterSQL  string
	CountCurrentSQL      string

	CountRevisionSQL string

	AfterSQLPrefix string

	AfterSQL  string
	DeleteSQL string

	UpdateCompactSQL string

	InsertSQL string

	FillSQL string

	InsertLastInsertIDSQL string

	GetSizeSQL string

	Retry        ErrRetry
	TranslateErr TranslateErr
	ErrCode      ErrCode

	AdmissionControlPolicy AdmissionControlPolicy

	// CompactInterval is interval between database compactions performed by kine.
	CompactInterval time.Duration
	// PollInterval is the event poll interval used by kine.
	PollInterval time.Duration
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, driverName, dataSourceName string, paramCharacter string, numbered bool) (*Generic, error)

func (*Generic) After

func (d *Generic) After(ctx context.Context, rev, limit int64) (*sql.Rows, error)

func (*Generic) AfterPrefix

func (d *Generic) AfterPrefix(ctx context.Context, prefix string, rev, limit int64) (*sql.Rows, error)

func (*Generic) Count

func (d *Generic) Count(ctx context.Context, prefix, startKey string, revision int64) (int64, int64, error)

func (*Generic) CountCurrent

func (d *Generic) CountCurrent(ctx context.Context, prefix string, startKey string) (int64, int64, error)

func (*Generic) CurrentRevision

func (d *Generic) CurrentRevision(ctx context.Context) (int64, error)

func (*Generic) DeleteRevision

func (d *Generic) DeleteRevision(ctx context.Context, revision int64) error

func (*Generic) Fill

func (d *Generic) Fill(ctx context.Context, revision int64) error

func (*Generic) GetCompactInterval

func (d *Generic) GetCompactInterval() time.Duration

func (*Generic) GetCompactRevision

func (d *Generic) GetCompactRevision(ctx context.Context) (int64, int64, error)

func (*Generic) GetPollInterval

func (d *Generic) GetPollInterval() time.Duration

func (*Generic) GetRevision

func (d *Generic) GetRevision(ctx context.Context, revision int64) (*sql.Rows, error)

func (*Generic) GetSize

func (d *Generic) GetSize(ctx context.Context) (int64, error)

func (*Generic) Insert

func (d *Generic) Insert(ctx context.Context, key string, create, delete bool, createRevision, previousRevision int64, ttl int64, value, prevValue []byte) (id int64, err error)

func (*Generic) IsFill

func (d *Generic) IsFill(key string) bool

func (*Generic) List

func (d *Generic) List(ctx context.Context, prefix, startKey string, limit, revision int64, includeDeleted bool) (*sql.Rows, error)

func (*Generic) ListCurrent

func (d *Generic) ListCurrent(ctx context.Context, prefix, startKey string, limit int64, includeDeleted bool) (*sql.Rows, error)

func (*Generic) Prepare

func (d *Generic) Prepare() error

func (*Generic) SetCompactRevision

func (d *Generic) SetCompactRevision(ctx context.Context, revision int64) error

type Stripped

type Stripped string

func (Stripped) String

func (s Stripped) String() string

type TranslateErr

type TranslateErr func(error) error

Jump to

Keyboard shortcuts

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