store

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect added in v0.5.0

func Connect(dsn setup.DSN, emitter stats.Sender) (*mysqlStore, error)

func New added in v0.5.0

func New(db *sql.DB, emitter stats.Sender) (*mysqlStore, error)

Types

type Index

type Index interface {
	Versions(module string) ([]string, error)
	Info(coordinates.Module) (repository.RevInfo, error) // .info json
	Contains(coordinates.Module) (bool, int64, error)
	UpdateID(coordinates.SerialModule) error
	Mod(coordinates.Module) (string, error) // go.mod file
	Remove(coordinates.Module) error
	Put(ModuleAddition) error
	IDs() (Ranges, error)
	Summary() (int, int, error)
}

The Index is used to provide:

  • .mod file content
  • .info file content
  • boolean whether a module@version exists in the store
  • list of versions of a given module that exist in the store
  • list of version intervals for all modules in the store

The real implementation is an index backed by boltdb, so we get better performance than keeping actual files on disk.

func NewIndex

func NewIndex(options IndexOptions) (Index, error)

type IndexMock

type IndexMock struct {
	ContainsMock mIndexMockContains

	IDsMock mIndexMockIDs

	InfoMock mIndexMockInfo

	ModMock mIndexMockMod

	PutMock mIndexMockPut

	RemoveMock mIndexMockRemove

	SummaryMock mIndexMockSummary

	UpdateIDMock mIndexMockUpdateID

	VersionsMock mIndexMockVersions
	// contains filtered or unexported fields
}

IndexMock implements Index

func NewIndexMock

func NewIndexMock(t minimock.Tester) *IndexMock

NewIndexMock returns a mock for Index

func (*IndexMock) Contains

func (mmContains *IndexMock) Contains(m1 coordinates.Module) (b1 bool, i1 int64, err error)

Contains implements Index

func (*IndexMock) ContainsAfterCounter

func (mmContains *IndexMock) ContainsAfterCounter() uint64

ContainsAfterCounter returns a count of finished IndexMock.Contains invocations

func (*IndexMock) ContainsBeforeCounter

func (mmContains *IndexMock) ContainsBeforeCounter() uint64

ContainsBeforeCounter returns a count of IndexMock.Contains invocations

func (*IndexMock) IDs

func (mmIDs *IndexMock) IDs() (r1 Ranges, err error)

IDs implements Index

func (*IndexMock) IDsAfterCounter

func (mmIDs *IndexMock) IDsAfterCounter() uint64

IDsAfterCounter returns a count of finished IndexMock.IDs invocations

func (*IndexMock) IDsBeforeCounter

func (mmIDs *IndexMock) IDsBeforeCounter() uint64

IDsBeforeCounter returns a count of IndexMock.IDs invocations

func (*IndexMock) Info

func (mmInfo *IndexMock) Info(m1 coordinates.Module) (r1 repository.RevInfo, err error)

Info implements Index

func (*IndexMock) InfoAfterCounter

func (mmInfo *IndexMock) InfoAfterCounter() uint64

InfoAfterCounter returns a count of finished IndexMock.Info invocations

func (*IndexMock) InfoBeforeCounter

func (mmInfo *IndexMock) InfoBeforeCounter() uint64

InfoBeforeCounter returns a count of IndexMock.Info invocations

func (*IndexMock) MinimockContainsDone

func (m *IndexMock) MinimockContainsDone() bool

MinimockContainsDone returns true if the count of the Contains invocations corresponds the number of defined expectations

func (*IndexMock) MinimockContainsInspect

func (m *IndexMock) MinimockContainsInspect()

MinimockContainsInspect logs each unmet expectation

func (*IndexMock) MinimockFinish

func (m *IndexMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*IndexMock) MinimockIDsDone

func (m *IndexMock) MinimockIDsDone() bool

MinimockIDsDone returns true if the count of the IDs invocations corresponds the number of defined expectations

func (*IndexMock) MinimockIDsInspect

func (m *IndexMock) MinimockIDsInspect()

MinimockIDsInspect logs each unmet expectation

func (*IndexMock) MinimockInfoDone

func (m *IndexMock) MinimockInfoDone() bool

MinimockInfoDone returns true if the count of the Info invocations corresponds the number of defined expectations

func (*IndexMock) MinimockInfoInspect

func (m *IndexMock) MinimockInfoInspect()

MinimockInfoInspect logs each unmet expectation

func (*IndexMock) MinimockModDone

func (m *IndexMock) MinimockModDone() bool

MinimockModDone returns true if the count of the Mod invocations corresponds the number of defined expectations

func (*IndexMock) MinimockModInspect

func (m *IndexMock) MinimockModInspect()

MinimockModInspect logs each unmet expectation

func (*IndexMock) MinimockPutDone

func (m *IndexMock) MinimockPutDone() bool

MinimockPutDone returns true if the count of the Put invocations corresponds the number of defined expectations

func (*IndexMock) MinimockPutInspect

func (m *IndexMock) MinimockPutInspect()

MinimockPutInspect logs each unmet expectation

func (*IndexMock) MinimockRemoveDone

func (m *IndexMock) MinimockRemoveDone() bool

MinimockRemoveDone returns true if the count of the Remove invocations corresponds the number of defined expectations

func (*IndexMock) MinimockRemoveInspect

func (m *IndexMock) MinimockRemoveInspect()

MinimockRemoveInspect logs each unmet expectation

func (*IndexMock) MinimockSummaryDone

func (m *IndexMock) MinimockSummaryDone() bool

MinimockSummaryDone returns true if the count of the Summary invocations corresponds the number of defined expectations

func (*IndexMock) MinimockSummaryInspect

func (m *IndexMock) MinimockSummaryInspect()

MinimockSummaryInspect logs each unmet expectation

func (*IndexMock) MinimockUpdateIDDone

func (m *IndexMock) MinimockUpdateIDDone() bool

MinimockUpdateIDDone returns true if the count of the UpdateID invocations corresponds the number of defined expectations

func (*IndexMock) MinimockUpdateIDInspect

func (m *IndexMock) MinimockUpdateIDInspect()

MinimockUpdateIDInspect logs each unmet expectation

func (*IndexMock) MinimockVersionsDone

func (m *IndexMock) MinimockVersionsDone() bool

MinimockVersionsDone returns true if the count of the Versions invocations corresponds the number of defined expectations

func (*IndexMock) MinimockVersionsInspect

func (m *IndexMock) MinimockVersionsInspect()

MinimockVersionsInspect logs each unmet expectation

func (*IndexMock) MinimockWait

func (m *IndexMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*IndexMock) Mod

func (mmMod *IndexMock) Mod(m1 coordinates.Module) (s1 string, err error)

Mod implements Index

func (*IndexMock) ModAfterCounter

func (mmMod *IndexMock) ModAfterCounter() uint64

ModAfterCounter returns a count of finished IndexMock.Mod invocations

func (*IndexMock) ModBeforeCounter

func (mmMod *IndexMock) ModBeforeCounter() uint64

ModBeforeCounter returns a count of IndexMock.Mod invocations

func (*IndexMock) Put

func (mmPut *IndexMock) Put(m1 ModuleAddition) (err error)

Put implements Index

func (*IndexMock) PutAfterCounter

func (mmPut *IndexMock) PutAfterCounter() uint64

PutAfterCounter returns a count of finished IndexMock.Put invocations

func (*IndexMock) PutBeforeCounter

func (mmPut *IndexMock) PutBeforeCounter() uint64

PutBeforeCounter returns a count of IndexMock.Put invocations

func (*IndexMock) Remove

func (mmRemove *IndexMock) Remove(m1 coordinates.Module) (err error)

Remove implements Index

func (*IndexMock) RemoveAfterCounter

func (mmRemove *IndexMock) RemoveAfterCounter() uint64

RemoveAfterCounter returns a count of finished IndexMock.Remove invocations

func (*IndexMock) RemoveBeforeCounter

func (mmRemove *IndexMock) RemoveBeforeCounter() uint64

RemoveBeforeCounter returns a count of IndexMock.Remove invocations

func (*IndexMock) Summary

func (mmSummary *IndexMock) Summary() (i1 int, i2 int, err error)

Summary implements Index

func (*IndexMock) SummaryAfterCounter

func (mmSummary *IndexMock) SummaryAfterCounter() uint64

SummaryAfterCounter returns a count of finished IndexMock.Summary invocations

func (*IndexMock) SummaryBeforeCounter

func (mmSummary *IndexMock) SummaryBeforeCounter() uint64

SummaryBeforeCounter returns a count of IndexMock.Summary invocations

func (*IndexMock) UpdateID

func (mmUpdateID *IndexMock) UpdateID(s1 coordinates.SerialModule) (err error)

UpdateID implements Index

func (*IndexMock) UpdateIDAfterCounter

func (mmUpdateID *IndexMock) UpdateIDAfterCounter() uint64

UpdateIDAfterCounter returns a count of finished IndexMock.UpdateID invocations

func (*IndexMock) UpdateIDBeforeCounter

func (mmUpdateID *IndexMock) UpdateIDBeforeCounter() uint64

UpdateIDBeforeCounter returns a count of IndexMock.UpdateID invocations

func (*IndexMock) Versions

func (mmVersions *IndexMock) Versions(module string) (sa1 []string, err error)

Versions implements Index

func (*IndexMock) VersionsAfterCounter

func (mmVersions *IndexMock) VersionsAfterCounter() uint64

VersionsAfterCounter returns a count of finished IndexMock.Versions invocations

func (*IndexMock) VersionsBeforeCounter

func (mmVersions *IndexMock) VersionsBeforeCounter() uint64

VersionsBeforeCounter returns a count of IndexMock.Versions invocations

type IndexMockContainsExpectation

type IndexMockContainsExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockContainsExpectation specifies expectation struct of the Index.Contains

func (*IndexMockContainsExpectation) Then

func (e *IndexMockContainsExpectation) Then(b1 bool, i1 int64, err error) *IndexMock

Then sets up Index.Contains return parameters for the expectation previously defined by the When method

type IndexMockContainsParams

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

IndexMockContainsParams contains parameters of the Index.Contains

type IndexMockContainsResults

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

IndexMockContainsResults contains results of the Index.Contains

type IndexMockIDsExpectation

type IndexMockIDsExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockIDsExpectation specifies expectation struct of the Index.IDs

type IndexMockIDsResults

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

IndexMockIDsResults contains results of the Index.IDs

type IndexMockInfoExpectation

type IndexMockInfoExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockInfoExpectation specifies expectation struct of the Index.Info

func (*IndexMockInfoExpectation) Then

Then sets up Index.Info return parameters for the expectation previously defined by the When method

type IndexMockInfoParams

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

IndexMockInfoParams contains parameters of the Index.Info

type IndexMockInfoResults

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

IndexMockInfoResults contains results of the Index.Info

type IndexMockModExpectation

type IndexMockModExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockModExpectation specifies expectation struct of the Index.Mod

func (*IndexMockModExpectation) Then

func (e *IndexMockModExpectation) Then(s1 string, err error) *IndexMock

Then sets up Index.Mod return parameters for the expectation previously defined by the When method

type IndexMockModParams

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

IndexMockModParams contains parameters of the Index.Mod

type IndexMockModResults

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

IndexMockModResults contains results of the Index.Mod

type IndexMockPutExpectation

type IndexMockPutExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockPutExpectation specifies expectation struct of the Index.Put

func (*IndexMockPutExpectation) Then

func (e *IndexMockPutExpectation) Then(err error) *IndexMock

Then sets up Index.Put return parameters for the expectation previously defined by the When method

type IndexMockPutParams

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

IndexMockPutParams contains parameters of the Index.Put

type IndexMockPutResults

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

IndexMockPutResults contains results of the Index.Put

type IndexMockRemoveExpectation

type IndexMockRemoveExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockRemoveExpectation specifies expectation struct of the Index.Remove

func (*IndexMockRemoveExpectation) Then

Then sets up Index.Remove return parameters for the expectation previously defined by the When method

type IndexMockRemoveParams

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

IndexMockRemoveParams contains parameters of the Index.Remove

type IndexMockRemoveResults

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

IndexMockRemoveResults contains results of the Index.Remove

type IndexMockSummaryExpectation

type IndexMockSummaryExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockSummaryExpectation specifies expectation struct of the Index.Summary

type IndexMockSummaryResults

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

IndexMockSummaryResults contains results of the Index.Summary

type IndexMockUpdateIDExpectation

type IndexMockUpdateIDExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockUpdateIDExpectation specifies expectation struct of the Index.UpdateID

func (*IndexMockUpdateIDExpectation) Then

Then sets up Index.UpdateID return parameters for the expectation previously defined by the When method

type IndexMockUpdateIDParams

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

IndexMockUpdateIDParams contains parameters of the Index.UpdateID

type IndexMockUpdateIDResults

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

IndexMockUpdateIDResults contains results of the Index.UpdateID

type IndexMockVersionsExpectation

type IndexMockVersionsExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

IndexMockVersionsExpectation specifies expectation struct of the Index.Versions

func (*IndexMockVersionsExpectation) Then

func (e *IndexMockVersionsExpectation) Then(sa1 []string, err error) *IndexMock

Then sets up Index.Versions return parameters for the expectation previously defined by the When method

type IndexMockVersionsParams

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

IndexMockVersionsParams contains parameters of the Index.Versions

type IndexMockVersionsResults

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

IndexMockVersionsResults contains results of the Index.Versions

type IndexOptions

type IndexOptions struct {
	Directory   string
	OpenTimeout time.Duration
}

type ModuleAddition

type ModuleAddition struct {
	Mod      coordinates.Module
	UniqueID int64
	ModFile  string
}

func (ModuleAddition) String added in v0.6.0

func (m ModuleAddition) String() string

type Options

type Options struct {
	Directory    string
	TmpDirectory string
}

type Range

type Range = coordinates.RangeID

Range is an alias of coordinates.RangeID for brevity.

type Ranges

type Ranges = coordinates.RangeIDs

Ranges is an alias of coordinates.RangeIDs for brevity.

type ZipStore

type ZipStore interface {
	PutZip(coordinates.Module, repository.Blob) error
	GetZip(coordinates.Module) (repository.Blob, error)
	DelZip(coordinates.Module) error
}

func NewStore

func NewStore(options Options, emitter stats.Sender) ZipStore

type ZipStoreMock

type ZipStoreMock struct {
	DelZipMock mZipStoreMockDelZip

	GetZipMock mZipStoreMockGetZip

	PutZipMock mZipStoreMockPutZip
	// contains filtered or unexported fields
}

ZipStoreMock implements ZipStore

func NewZipStoreMock

func NewZipStoreMock(t minimock.Tester) *ZipStoreMock

NewZipStoreMock returns a mock for ZipStore

func (*ZipStoreMock) DelZip

func (mmDelZip *ZipStoreMock) DelZip(m1 coordinates.Module) (err error)

DelZip implements ZipStore

func (*ZipStoreMock) DelZipAfterCounter

func (mmDelZip *ZipStoreMock) DelZipAfterCounter() uint64

DelZipAfterCounter returns a count of finished ZipStoreMock.DelZip invocations

func (*ZipStoreMock) DelZipBeforeCounter

func (mmDelZip *ZipStoreMock) DelZipBeforeCounter() uint64

DelZipBeforeCounter returns a count of ZipStoreMock.DelZip invocations

func (*ZipStoreMock) GetZip

func (mmGetZip *ZipStoreMock) GetZip(m1 coordinates.Module) (b1 repository.Blob, err error)

GetZip implements ZipStore

func (*ZipStoreMock) GetZipAfterCounter

func (mmGetZip *ZipStoreMock) GetZipAfterCounter() uint64

GetZipAfterCounter returns a count of finished ZipStoreMock.GetZip invocations

func (*ZipStoreMock) GetZipBeforeCounter

func (mmGetZip *ZipStoreMock) GetZipBeforeCounter() uint64

GetZipBeforeCounter returns a count of ZipStoreMock.GetZip invocations

func (*ZipStoreMock) MinimockDelZipDone

func (m *ZipStoreMock) MinimockDelZipDone() bool

MinimockDelZipDone returns true if the count of the DelZip invocations corresponds the number of defined expectations

func (*ZipStoreMock) MinimockDelZipInspect

func (m *ZipStoreMock) MinimockDelZipInspect()

MinimockDelZipInspect logs each unmet expectation

func (*ZipStoreMock) MinimockFinish

func (m *ZipStoreMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*ZipStoreMock) MinimockGetZipDone

func (m *ZipStoreMock) MinimockGetZipDone() bool

MinimockGetZipDone returns true if the count of the GetZip invocations corresponds the number of defined expectations

func (*ZipStoreMock) MinimockGetZipInspect

func (m *ZipStoreMock) MinimockGetZipInspect()

MinimockGetZipInspect logs each unmet expectation

func (*ZipStoreMock) MinimockPutZipDone

func (m *ZipStoreMock) MinimockPutZipDone() bool

MinimockPutZipDone returns true if the count of the PutZip invocations corresponds the number of defined expectations

func (*ZipStoreMock) MinimockPutZipInspect

func (m *ZipStoreMock) MinimockPutZipInspect()

MinimockPutZipInspect logs each unmet expectation

func (*ZipStoreMock) MinimockWait

func (m *ZipStoreMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*ZipStoreMock) PutZip

func (mmPutZip *ZipStoreMock) PutZip(m1 coordinates.Module, b1 repository.Blob) (err error)

PutZip implements ZipStore

func (*ZipStoreMock) PutZipAfterCounter

func (mmPutZip *ZipStoreMock) PutZipAfterCounter() uint64

PutZipAfterCounter returns a count of finished ZipStoreMock.PutZip invocations

func (*ZipStoreMock) PutZipBeforeCounter

func (mmPutZip *ZipStoreMock) PutZipBeforeCounter() uint64

PutZipBeforeCounter returns a count of ZipStoreMock.PutZip invocations

type ZipStoreMockDelZipExpectation

type ZipStoreMockDelZipExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ZipStoreMockDelZipExpectation specifies expectation struct of the ZipStore.DelZip

func (*ZipStoreMockDelZipExpectation) Then

Then sets up ZipStore.DelZip return parameters for the expectation previously defined by the When method

type ZipStoreMockDelZipParams

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

ZipStoreMockDelZipParams contains parameters of the ZipStore.DelZip

type ZipStoreMockDelZipResults

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

ZipStoreMockDelZipResults contains results of the ZipStore.DelZip

type ZipStoreMockGetZipExpectation

type ZipStoreMockGetZipExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ZipStoreMockGetZipExpectation specifies expectation struct of the ZipStore.GetZip

func (*ZipStoreMockGetZipExpectation) Then

Then sets up ZipStore.GetZip return parameters for the expectation previously defined by the When method

type ZipStoreMockGetZipParams

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

ZipStoreMockGetZipParams contains parameters of the ZipStore.GetZip

type ZipStoreMockGetZipResults

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

ZipStoreMockGetZipResults contains results of the ZipStore.GetZip

type ZipStoreMockPutZipExpectation

type ZipStoreMockPutZipExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ZipStoreMockPutZipExpectation specifies expectation struct of the ZipStore.PutZip

func (*ZipStoreMockPutZipExpectation) Then

Then sets up ZipStore.PutZip return parameters for the expectation previously defined by the When method

type ZipStoreMockPutZipParams

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

ZipStoreMockPutZipParams contains parameters of the ZipStore.PutZip

type ZipStoreMockPutZipResults

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

ZipStoreMockPutZipResults contains results of the ZipStore.PutZip

Jump to

Keyboard shortcuts

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