store

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_TAG_LENGTH = 3
View Source
const MIN_TAG_LENGTH = 1

Variables

View Source
var RecordNotFoundError = errors.New("record not found")

Functions

This section is empty.

Types

type Destination

type Destination struct {
	ID       string
	Tag      string
	Protocol string
	Port     int
	Ports    Ports
}

type DestinationRepo

type DestinationRepo interface {
	Create(Transaction, int, int, int, int, string) (int, error)
	Delete(Transaction, int) error
	GetID(Transaction, int, int, int, int, string) (int, error)
	CountWhereGroupID(Transaction, int) (int, error)
}

type DestinationTable added in v1.4.0

type DestinationTable struct {
}

func (*DestinationTable) CountWhereGroupID added in v1.4.0

func (d *DestinationTable) CountWhereGroupID(tx Transaction, group_id int) (int, error)

func (*DestinationTable) Create added in v1.4.0

func (d *DestinationTable) Create(tx Transaction, destination_group_id, port, startPort, endPort int, protocol string) (int, error)

func (*DestinationTable) Delete added in v1.4.0

func (d *DestinationTable) Delete(tx Transaction, id int) error

func (*DestinationTable) GetID added in v1.4.0

func (d *DestinationTable) GetID(tx Transaction, destination_group_id, port, startPort, endPort int, protocol string) (int, error)

type GroupRepo

type GroupRepo interface {
	Create(Transaction, string) (int, error)
	Delete(Transaction, int) error
	GetID(Transaction, string) (int, error)
}

type GroupTable added in v1.4.0

type GroupTable struct {
}

func (*GroupTable) Create added in v1.4.0

func (g *GroupTable) Create(tx Transaction, guid string) (int, error)

func (*GroupTable) Delete added in v1.4.0

func (g *GroupTable) Delete(tx Transaction, id int) error

func (*GroupTable) GetID added in v1.4.0

func (g *GroupTable) GetID(tx Transaction, guid string) (int, error)

type MetricsWrapper added in v0.17.0

type MetricsWrapper struct {
	Store         Store
	MetricsSender metricsSender
}

func (*MetricsWrapper) All added in v0.17.0

func (mw *MetricsWrapper) All() ([]Policy, error)

func (*MetricsWrapper) ByGuids added in v0.17.0

func (mw *MetricsWrapper) ByGuids(srcGuids, dstGuids []string, inSourceAndDest bool) ([]Policy, error)

func (*MetricsWrapper) CheckDatabase added in v1.0.0

func (mw *MetricsWrapper) CheckDatabase() error

func (*MetricsWrapper) Create added in v0.17.0

func (mw *MetricsWrapper) Create(policies []Policy) error

func (*MetricsWrapper) Delete added in v0.17.0

func (mw *MetricsWrapper) Delete(policies []Policy) error

func (*MetricsWrapper) Tags added in v0.17.0

func (mw *MetricsWrapper) Tags() ([]Tag, error)

type Migrator added in v1.4.0

type Migrator interface {
	PerformMigrations(driverName string, migrationDb migrations.MigrationDb, maxNumMigrations int) (int, error)
}

type Policy

type Policy struct {
	Source      Source
	Destination Destination
}

type PolicyRepo

type PolicyRepo interface {
	Create(Transaction, int, int) error
	Delete(Transaction, int, int) error
	CountWhereGroupID(Transaction, int) (int, error)
	CountWhereDestinationID(Transaction, int) (int, error)
}

type PolicyTable added in v1.4.0

type PolicyTable struct {
}

func (*PolicyTable) CountWhereDestinationID added in v1.4.0

func (p *PolicyTable) CountWhereDestinationID(tx Transaction, destination_id int) (int, error)

func (*PolicyTable) CountWhereGroupID added in v1.4.0

func (p *PolicyTable) CountWhereGroupID(tx Transaction, source_group_id int) (int, error)

func (*PolicyTable) Create added in v1.4.0

func (p *PolicyTable) Create(tx Transaction, source_group_id int, destination_id int) error

func (*PolicyTable) Delete added in v1.4.0

func (p *PolicyTable) Delete(tx Transaction, source_group_id int, destination_id int) error

type Ports added in v1.4.0

type Ports struct {
	Start int
	End   int
}

type Source added in v1.4.0

type Source struct {
	ID  string
	Tag string
}

type Store

type Store interface {
	Create([]Policy) error
	All() ([]Policy, error)
	Delete([]Policy) error
	Tags() ([]Tag, error)
	ByGuids([]string, []string, bool) ([]Policy, error)
	CheckDatabase() error
}

func New

func New(dbConnectionPool db, migrationDbConnectionPool db, g GroupRepo, d DestinationRepo, p PolicyRepo, tl int, migrator Migrator) (Store, error)

type Tag added in v1.4.0

type Tag struct {
	ID  string
	Tag string
}

type Transaction

type Transaction interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	QueryRow(query string, args ...interface{}) *sql.Row
	Commit() error
	Rollback() error
	Rebind(string) string
	DriverName() string
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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