Documentation ¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type DBErrorType
- type Database
- type DatabaseError
- type GorpDatabase
- func (db *GorpDatabase) DeleteLogChunksForArtifact(artifactID int64) (int64, *DatabaseError)
- func (db *GorpDatabase) GetArtifactByName(bucketId string, artifactName string) (*model.Artifact, *DatabaseError)
- func (db *GorpDatabase) GetBucket(id string) (*model.Bucket, *DatabaseError)
- func (db *GorpDatabase) GetLastLogChunkSeenForArtifact(artifactID int64) (*model.LogChunk, *DatabaseError)
- func (db *GorpDatabase) InsertArtifact(artifact *model.Artifact) *DatabaseError
- func (db *GorpDatabase) InsertBucket(bucket *model.Bucket) *DatabaseError
- func (db *GorpDatabase) InsertLogChunk(logChunk *model.LogChunk) *DatabaseError
- func (db *GorpDatabase) ListArtifactsInBucket(bucketId string) ([]model.Artifact, *DatabaseError)
- func (db *GorpDatabase) ListBuckets() ([]model.Bucket, *DatabaseError)
- func (db *GorpDatabase) ListLogChunksInArtifact(artifactID int64, byteBegin int64, byteEnd int64) ([]model.LogChunk, *DatabaseError)
- func (db *GorpDatabase) RegisterEntities()
- func (db *GorpDatabase) UpdateArtifact(artifact *model.Artifact) *DatabaseError
- func (db *GorpDatabase) UpdateBucket(bucket *model.Bucket) *DatabaseError
- type MockDatabase
- func (_m *MockDatabase) DeleteLogChunksForArtifact(_a0 int64) (int64, *DatabaseError)
- func (_m *MockDatabase) GetArtifactByName(bucket string, name string) (*model.Artifact, *DatabaseError)
- func (_m *MockDatabase) GetBucket(_a0 string) (*model.Bucket, *DatabaseError)
- func (_m *MockDatabase) GetLastLogChunkSeenForArtifact(_a0 int64) (*model.LogChunk, *DatabaseError)
- func (_m *MockDatabase) InsertArtifact(_a0 *model.Artifact) *DatabaseError
- func (_m *MockDatabase) InsertBucket(_a0 *model.Bucket) *DatabaseError
- func (_m *MockDatabase) InsertLogChunk(_a0 *model.LogChunk) *DatabaseError
- func (_m *MockDatabase) ListArtifactsInBucket(_a0 string) ([]model.Artifact, *DatabaseError)
- func (_m *MockDatabase) ListBuckets() ([]model.Bucket, *DatabaseError)
- func (_m *MockDatabase) ListLogChunksInArtifact(_a0 int64, _a1 int64, _a2 int64) ([]model.LogChunk, *DatabaseError)
- func (_m *MockDatabase) RegisterEntities()
- func (_m *MockDatabase) UpdateArtifact(_a0 *model.Artifact) *DatabaseError
- func (_m *MockDatabase) UpdateBucket(_a0 *model.Bucket) *DatabaseError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type DBErrorType ¶
type DBErrorType int
const ( INTERNAL DBErrorType = iota // Fields not set or invalid VALIDATION_FAILURE // Entity not found in the database ENTITY_NOT_FOUND )
func (DBErrorType) String ¶
func (i DBErrorType) String() string
type Database ¶
type Database interface { // Register all DB table<->object mappings in memory RegisterEntities() // Bucket instance is expected to have id, datecreated, state and owner field set. InsertBucket(*model.Bucket) *DatabaseError InsertArtifact(*model.Artifact) *DatabaseError InsertLogChunk(*model.LogChunk) *DatabaseError // Bucket instance is expected to have id, datecreated, state and owner field set. UpdateBucket(*model.Bucket) *DatabaseError // TODO: Pagination and/or other forms of filtering ListBuckets() ([]model.Bucket, *DatabaseError) GetBucket(string) (*model.Bucket, *DatabaseError) ListArtifactsInBucket(string) ([]model.Artifact, *DatabaseError) UpdateArtifact(*model.Artifact) *DatabaseError ListLogChunksInArtifact(artifactID int64, offset int64, limit int64) ([]model.LogChunk, *DatabaseError) // Delete list of log chunks, primarily used to clean up log chunks after merging and uploading DeleteLogChunksForArtifact(int64) (int64, *DatabaseError) GetArtifactByName(bucket string, name string) (*model.Artifact, *DatabaseError) // Get last logchunk seen for an artifact. GetLastLogChunkSeenForArtifact(int64) (*model.LogChunk, *DatabaseError) }
type DatabaseError ¶
type DatabaseError struct {
// contains filtered or unexported fields
}
func MockDatabaseError ¶
func MockDatabaseError() *DatabaseError
func NewEntityNotFoundError ¶
func NewEntityNotFoundError(format string, args ...interface{}) *DatabaseError
func NewValidationError ¶
func NewValidationError(format string, args ...interface{}) *DatabaseError
func WrapInternalDatabaseError ¶
func WrapInternalDatabaseError(err error) *DatabaseError
func (*DatabaseError) EntityNotFound ¶
func (dbe *DatabaseError) EntityNotFound() bool
func (*DatabaseError) Error ¶
func (dbe *DatabaseError) Error() string
func (*DatabaseError) GetError ¶
func (dbe *DatabaseError) GetError() error
type GorpDatabase ¶
type GorpDatabase struct {
// contains filtered or unexported fields
}
func NewGorpDatabase ¶
func NewGorpDatabase(dbmap *gorp.DbMap) *GorpDatabase
func (*GorpDatabase) DeleteLogChunksForArtifact ¶
func (db *GorpDatabase) DeleteLogChunksForArtifact(artifactID int64) (int64, *DatabaseError)
DeleteLogChunksForArtifact deletes all log chunks for an artifact. Returns (number of deleted rows, err)
func (*GorpDatabase) GetArtifactByName ¶
func (db *GorpDatabase) GetArtifactByName(bucketId string, artifactName string) (*model.Artifact, *DatabaseError)
func (*GorpDatabase) GetBucket ¶
func (db *GorpDatabase) GetBucket(id string) (*model.Bucket, *DatabaseError)
func (*GorpDatabase) GetLastLogChunkSeenForArtifact ¶
func (db *GorpDatabase) GetLastLogChunkSeenForArtifact(artifactID int64) (*model.LogChunk, *DatabaseError)
GetLastLogChunkSeenForArtifact returns the last full logchunk present in the database associated with artifact.
func (*GorpDatabase) InsertArtifact ¶
func (db *GorpDatabase) InsertArtifact(artifact *model.Artifact) *DatabaseError
func (*GorpDatabase) InsertBucket ¶
func (db *GorpDatabase) InsertBucket(bucket *model.Bucket) *DatabaseError
func (*GorpDatabase) InsertLogChunk ¶
func (db *GorpDatabase) InsertLogChunk(logChunk *model.LogChunk) *DatabaseError
func (*GorpDatabase) ListArtifactsInBucket ¶
func (db *GorpDatabase) ListArtifactsInBucket(bucketId string) ([]model.Artifact, *DatabaseError)
func (*GorpDatabase) ListBuckets ¶
func (db *GorpDatabase) ListBuckets() ([]model.Bucket, *DatabaseError)
func (*GorpDatabase) ListLogChunksInArtifact ¶
func (db *GorpDatabase) ListLogChunksInArtifact(artifactID int64, byteBegin int64, byteEnd int64) ([]model.LogChunk, *DatabaseError)
func (*GorpDatabase) RegisterEntities ¶
func (db *GorpDatabase) RegisterEntities()
func (*GorpDatabase) UpdateArtifact ¶
func (db *GorpDatabase) UpdateArtifact(artifact *model.Artifact) *DatabaseError
func (*GorpDatabase) UpdateBucket ¶
func (db *GorpDatabase) UpdateBucket(bucket *model.Bucket) *DatabaseError
type MockDatabase ¶
func (*MockDatabase) DeleteLogChunksForArtifact ¶
func (_m *MockDatabase) DeleteLogChunksForArtifact(_a0 int64) (int64, *DatabaseError)
func (*MockDatabase) GetArtifactByName ¶
func (_m *MockDatabase) GetArtifactByName(bucket string, name string) (*model.Artifact, *DatabaseError)
func (*MockDatabase) GetBucket ¶
func (_m *MockDatabase) GetBucket(_a0 string) (*model.Bucket, *DatabaseError)
func (*MockDatabase) GetLastLogChunkSeenForArtifact ¶
func (_m *MockDatabase) GetLastLogChunkSeenForArtifact(_a0 int64) (*model.LogChunk, *DatabaseError)
func (*MockDatabase) InsertArtifact ¶
func (_m *MockDatabase) InsertArtifact(_a0 *model.Artifact) *DatabaseError
func (*MockDatabase) InsertBucket ¶
func (_m *MockDatabase) InsertBucket(_a0 *model.Bucket) *DatabaseError
func (*MockDatabase) InsertLogChunk ¶
func (_m *MockDatabase) InsertLogChunk(_a0 *model.LogChunk) *DatabaseError
func (*MockDatabase) ListArtifactsInBucket ¶
func (_m *MockDatabase) ListArtifactsInBucket(_a0 string) ([]model.Artifact, *DatabaseError)
func (*MockDatabase) ListBuckets ¶
func (_m *MockDatabase) ListBuckets() ([]model.Bucket, *DatabaseError)
func (*MockDatabase) ListLogChunksInArtifact ¶
func (_m *MockDatabase) ListLogChunksInArtifact(_a0 int64, _a1 int64, _a2 int64) ([]model.LogChunk, *DatabaseError)
func (*MockDatabase) RegisterEntities ¶
func (_m *MockDatabase) RegisterEntities()
func (*MockDatabase) UpdateArtifact ¶
func (_m *MockDatabase) UpdateArtifact(_a0 *model.Artifact) *DatabaseError
func (*MockDatabase) UpdateBucket ¶
func (_m *MockDatabase) UpdateBucket(_a0 *model.Bucket) *DatabaseError