mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 11:25:41 +03:00
Job History schema
This commit is contained in:
@@ -20,6 +20,7 @@ func stateStoreSchema() *memdb.DBSchema {
|
||||
nodeTableSchema,
|
||||
jobTableSchema,
|
||||
jobSummarySchema,
|
||||
jobHistorySchema,
|
||||
periodicLaunchTableSchema,
|
||||
evalTableSchema,
|
||||
allocTableSchema,
|
||||
@@ -141,6 +142,37 @@ func jobSummarySchema() *memdb.TableSchema {
|
||||
}
|
||||
}
|
||||
|
||||
// jobHistorySchema returns the memdb schema for the job history table which
|
||||
// keeps a historical view of jobs.
|
||||
func jobHistorySchema() *memdb.TableSchema {
|
||||
return &memdb.TableSchema{
|
||||
Name: "job_histories",
|
||||
Indexes: map[string]*memdb.IndexSchema{
|
||||
"id": &memdb.IndexSchema{
|
||||
Name: "id",
|
||||
AllowMissing: false,
|
||||
Unique: true,
|
||||
|
||||
// Use a compound index so the tuple of (JobID, Version) is
|
||||
// uniquely identifying
|
||||
Indexer: &memdb.CompoundIndex{
|
||||
Indexes: []memdb.Indexer{
|
||||
&memdb.StringFieldIndex{
|
||||
Field: "JobID",
|
||||
Lowercase: true,
|
||||
},
|
||||
|
||||
// Will need to create a new indexer
|
||||
&memdb.UintFieldIndex{
|
||||
Field: "Version",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// jobIsGCable satisfies the ConditionalIndexFunc interface and creates an index
|
||||
// on whether a job is eligible for garbage collection.
|
||||
func jobIsGCable(obj interface{}) (bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user