database

package
v1.0.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigCache

type ConfigCache interface {
	GetConfigObject(context.Context, *configV1.ConfigRef) (*configV1.ConfigObject, error)
	HasCrawledContent(ctx context.Context, revisitKey string) (*contentwriter.CrawledContent, error)
	WriteCrawledContent(ctx context.Context, crawledContent *contentwriter.CrawledContent) error
}

func NewConfigCache

func NewConfigCache(db DbAdapter, ttl time.Duration) ConfigCache

type DbAdapter

type DbAdapter interface {
	GetConfigObject(context.Context, *configV1.ConfigRef) (*configV1.ConfigObject, error)
	HasCrawledContent(ctx context.Context, revisitKey string) (*contentwriter.CrawledContent, error)
	WriteCrawledContent(ctx context.Context, crawledContent *contentwriter.CrawledContent) error
}

type MockConnection

type MockConnection struct {
	*RethinkDbConnection
}

func NewMockConnection

func NewMockConnection() *MockConnection

NewMockConnection creates a new mocked RethinkDbConnection object

func (*MockConnection) Close

func (c *MockConnection) Close() error

func (*MockConnection) GetConfigObject

func (c *MockConnection) GetConfigObject(ctx context.Context, ref *configV1.ConfigRef) (*configV1.ConfigObject, error)

func (*MockConnection) GetMock

func (c *MockConnection) GetMock() *r.Mock

func (*MockConnection) HasCrawledContent

func (c *MockConnection) HasCrawledContent(ctx context.Context, revisitKey string) (*contentwriter.CrawledContent, error)

func (*MockConnection) WriteCrawledContent

func (c *MockConnection) WriteCrawledContent(ctx context.Context, crawledContent *contentwriter.CrawledContent) error

type Options

type Options struct {
	Username           string
	Password           string
	Database           string
	UseOpenTracing     bool
	Address            string
	QueryTimeout       time.Duration
	MaxRetries         int
	MaxOpenConnections int
}

type RethinkDbConnection

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

RethinkDbConnection holds the database connection

func NewRethinkDbConnection

func NewRethinkDbConnection(opts Options) *RethinkDbConnection

NewRethinkDbConnection creates a new RethinkDbConnection object

func (*RethinkDbConnection) Close

func (c *RethinkDbConnection) Close() error

Close closes the RethinkDbConnection

func (*RethinkDbConnection) Connect

func (c *RethinkDbConnection) Connect() error

Connect establishes connections

func (*RethinkDbConnection) GetConfigObject

func (c *RethinkDbConnection) GetConfigObject(ctx context.Context, ref *configV1.ConfigRef) (*configV1.ConfigObject, error)

GetConfigObject fetches a config.ConfigObject referenced by a config.ConfigRef

func (*RethinkDbConnection) HasCrawledContent

func (c *RethinkDbConnection) HasCrawledContent(ctx context.Context, payloadDigest string) (*contentwriter.CrawledContent, error)

func (*RethinkDbConnection) WriteCrawledContent

func (c *RethinkDbConnection) WriteCrawledContent(ctx context.Context, crawledContent *contentwriter.CrawledContent) error

Jump to

Keyboard shortcuts

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