Skip to content

Commit

Permalink
Merge pull request #152 from JimmyYang20/fixbug
Browse files Browse the repository at this point in the history
IL: LC supports to recover job when restart
  • Loading branch information
kubeedge-bot authored Aug 13, 2021
2 parents ce08694 + bf39a7c commit 8485c90
Show file tree
Hide file tree
Showing 2 changed files with 332 additions and 209 deletions.
13 changes: 13 additions & 0 deletions pkg/localcontroller/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package db

import (
"encoding/json"
"fmt"
"os"
"path/filepath"

Expand Down Expand Up @@ -77,6 +78,18 @@ func SaveResource(name string, typeMeta, objectMeta, spec interface{}) error {
return nil
}

// GetResource gets resource info in db
func GetResource(name string) (*Resource, error) {
r := Resource{}

queryResult := dbClient.Where("name = ?", name).First(&r)
if queryResult.RowsAffected == 0 {
return nil, fmt.Errorf("resource(name=%s) not in db", name)
}

return &r, nil
}

// DeleteResource deletes resource info in db
func DeleteResource(name string) error {
var err error
Expand Down
Loading

0 comments on commit 8485c90

Please sign in to comment.