Skip to content

Commit

Permalink
removed GetFirstRevisionForPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
romangithub1024 committed Jun 12, 2018
1 parent e8beec0 commit fe00d88
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
1 change: 0 additions & 1 deletion pkg/runtime/store/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type Policy interface {
// Revision represents database operations for Revision object
type Revision interface {
GetRevision(gen runtime.Generation) (*engine.Revision, error)
GetFirstRevisionForPolicy(policyGen runtime.Generation) (*engine.Revision, error)
GetLastRevisionForPolicy(policyGen runtime.Generation) (*engine.Revision, error)
GetAllRevisionsForPolicy(policyGen runtime.Generation) ([]*engine.Revision, error)
NewRevision(policyGen runtime.Generation) (*engine.Revision, error)
Expand Down
24 changes: 0 additions & 24 deletions pkg/runtime/store/core/revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,6 @@ func (ds *defaultStore) GetRevision(gen runtime.Generation) (*engine.Revision, e
return data, nil
}

// GetFirstRevisionForPolicy returns first revision for specified policy generation in chronological order
func (ds *defaultStore) GetFirstRevisionForPolicy(policyGen runtime.Generation) (*engine.Revision, error) {
// TODO: this method is slow, needs indexes
revisionObjs, err := ds.store.ListGenerations(engine.RevisionKey)
if err != nil {
return nil, err
}

var result *engine.Revision
for _, revisionObj := range revisionObjs {
revision := revisionObj.(*engine.Revision)

if revision.Policy != policyGen {
continue
}

if result == nil || revision.GetGeneration() < result.GetGeneration() {
result = revision
}
}

return result, nil
}

// GetLastRevisionForPolicy returns last revision for specified policy generation in chronological order
func (ds *defaultStore) GetLastRevisionForPolicy(policyGen runtime.Generation) (*engine.Revision, error) {
// TODO: this method is slow, needs indexes
Expand Down

0 comments on commit fe00d88

Please sign in to comment.