cleaning up manager, tying it to add files
This commit is contained in:
@@ -74,7 +74,7 @@ func (db *DB) RetrieveWatchedFiles() ([]File, error) {
|
||||
// InitialiseFileInDatabase should be called before any file is copied/renamed/diff'd/patched,
|
||||
// and this should be checked before any operation occurs on a file. Any loss of data is completely as a result
|
||||
// of losing references
|
||||
func (db *DB) InitialiseFileInDatabase(file File) (int, error) {
|
||||
func (db *DB) InitializeFileInDatabase(file File) (int, error) {
|
||||
if err := db.Save(&file); err != nil {
|
||||
db.Err(err).Msg("Error initialising file in database")
|
||||
return file.ID, err
|
||||
@@ -179,7 +179,7 @@ func (db *DB) RetrieveDiffsByID(ID int) (DiffObject, error) {
|
||||
// UpdateDescription is a simple function to set the label on a patch
|
||||
func (db *DB) UpdateDescription(patchID int, description string) error {
|
||||
fmt.Println("attempting to path with id ", patchID, " description ", description)
|
||||
if err := db.Update(&DiffObject{ID: patchID, Description: description}); err != nil {
|
||||
if err := db.Update(&DiffObject{ID: patchID}); err != nil {
|
||||
db.Err(err).Msg("Error changing diff label")
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ type CommitMeta struct {
|
||||
|
||||
// File represents a tracked file
|
||||
type File struct {
|
||||
ID int `storm:"id,increment"`
|
||||
Path string `storm:"index"`
|
||||
Name string
|
||||
BkpLocation string //TODO: Needed?
|
||||
ID int `storm:"id,increment"`
|
||||
Path string `storm:"index"`
|
||||
Name string
|
||||
//BkpLocation string //TODO: Needed?
|
||||
CurrentBase string
|
||||
CurrentHash [16]byte `storm:"index,unique"`
|
||||
CreatedAt time.Time
|
||||
@@ -44,20 +44,20 @@ type FileIndex struct {
|
||||
|
||||
// DiffObject store the information for each diff that is made
|
||||
type DiffObject struct {
|
||||
ID int `storm:"id,increment"`
|
||||
Subject string `storm:"index"`
|
||||
Object string `storm:"index"`
|
||||
SubjectHash [16]byte `storm:"index"`
|
||||
ObjectHash [16]byte `storm:"index"`
|
||||
Watching string //name of the file being watched
|
||||
DiffPath string //path of the diff/patch
|
||||
ID int `storm:"id,increment"`
|
||||
Target string `storm:"index"`
|
||||
DiffObject string `storm:"index"`
|
||||
TargetHash [16]byte `storm:"index"`
|
||||
DiffObjectHash [16]byte `storm:"index"`
|
||||
//Watching string //name of the file being watched
|
||||
DiffPath string //path of the diff/patch //path would be .gvc/hashofcommit/
|
||||
//Label string //store a comment if the user wants to (user written)
|
||||
//Screenshot string //path to the screen shot when the diff was made
|
||||
Fs bool //whether it was written to the directly
|
||||
Description string //record of forward or backward (just a quick helper)
|
||||
E error //a record of the error when it was created. Maybe able to optimize out later
|
||||
Diff *[]byte //the diff itself (incase we want to store in memory) - unused as of now
|
||||
DiffSize int64 //the size of the diff in bytes
|
||||
StartTime time.Time //when was the diff created (can take a while to create)
|
||||
Message string //any message we want to store against the diff while its created
|
||||
//Fs bool //whether it was written to the directly
|
||||
//Description string //record of forward or backward (just a quick helper)
|
||||
E error //a record of the error when it was created. Maybe able to optimize out later
|
||||
Diff *[]byte //the diff itself (incase we want to store in memory)
|
||||
DiffSize int64 //the size of the diff in bytes
|
||||
StartTime time.Time //when was the diff created (can take a while to create)
|
||||
Message string //any message we want to store against the diff while its created
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user