mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
c8229cc0d6
Almost two years ago, we began referring to the project as Fleet, but there are many occurences of the term "Kolide" throughout the UI and documentation. This PR attempts to clear up those uses where it is easily achievable. The term "Kolide" is used throughout the code as well, but modifying this would be more likely to introduce bugs.
78 lines
1.5 KiB
Go
78 lines
1.5 KiB
Go
package kolide
|
|
|
|
// Datastore combines all the interfaces in the Fleet DAL
|
|
type Datastore interface {
|
|
UserStore
|
|
QueryStore
|
|
CampaignStore
|
|
PackStore
|
|
LabelStore
|
|
HostStore
|
|
TargetStore
|
|
PasswordResetStore
|
|
SessionStore
|
|
AppConfigStore
|
|
InviteStore
|
|
ScheduledQueryStore
|
|
OptionStore
|
|
FileIntegrityMonitoringStore
|
|
YARAStore
|
|
OsqueryOptionsStore
|
|
Name() string
|
|
Drop() error
|
|
// MigrateTables creates and migrates the table schemas
|
|
MigrateTables() error
|
|
// MigrateData populates built-in data
|
|
MigrateData() error
|
|
// MigrationStatus returns nil if migrations are complete, and an error
|
|
// if migrations need to be run.
|
|
MigrationStatus() (MigrationStatus, error)
|
|
Begin() (Transaction, error)
|
|
}
|
|
|
|
type MigrationStatus int
|
|
|
|
const (
|
|
NoMigrationsCompleted = iota
|
|
SomeMigrationsCompleted
|
|
AllMigrationsCompleted
|
|
)
|
|
|
|
// NotFoundError is returned when the datastore resource cannot be found.
|
|
type NotFoundError interface {
|
|
error
|
|
IsNotFound() bool
|
|
}
|
|
|
|
func IsNotFound(err error) bool {
|
|
e, ok := err.(NotFoundError)
|
|
if !ok {
|
|
return false
|
|
}
|
|
return e.IsNotFound()
|
|
}
|
|
|
|
// AlreadyExists is returned when creating a datastore resource that already
|
|
// exists.
|
|
type AlreadyExistsError interface {
|
|
error
|
|
IsExists() bool
|
|
}
|
|
|
|
// ForeignKeyError is returned when the operation fails due to foreign key
|
|
// constraints.
|
|
type ForeignKeyError interface {
|
|
error
|
|
IsForeignKey() bool
|
|
}
|
|
|
|
func IsForeignKey(err error) bool {
|
|
e, ok := err.(ForeignKeyError)
|
|
if !ok {
|
|
return false
|
|
}
|
|
return e.IsForeignKey()
|
|
}
|
|
|
|
type OptionalArg func() interface{}
|