Skip to content
Snippets Groups Projects
Commit 1e35f058 authored by Christian Pointner's avatar Christian Pointner
Browse files

added struct for import representation in store

parent 3040e019
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ const (
publicGroupBn = "_public"
importsBn = "imports"
filesBn = "files"
playlistsBn = "playlists"
......@@ -46,7 +47,7 @@ const (
)
var (
groupBuckets = []string{filesBn, playlistsBn} // these buckets will be created inside every group bucket
groupBuckets = []string{importsBn, filesBn, playlistsBn} // these buckets will be created inside every group bucket
ErrNotImplented = errors.New("not implemented")
ErrNotFound = errors.New("not found")
......@@ -83,6 +84,43 @@ type TimeAndUser struct {
Timestamp time.Time `josn:"timestamp"`
}
// stored in importsBn
type ImportState int
const (
ImportNew ImportState = iota
ImportPending
ImportRunning
ImportAborted
ImportDone
)
func (s ImportState) String() string {
switch s {
case ImportNew:
return "new"
case ImportRunning:
return "running"
case ImportAborted:
return "aborted"
case ImportDone:
return "done"
}
return "unknown"
}
func (s ImportState) MarshalText() (data []byte, err error) {
data = []byte(s.String())
return
}
type Import struct {
Created TimeAndUser `json:"created"`
State ImportState `json:"state"`
Success bool `json:"success"`
Log map[int64]string `json:"log"`
}
// stored in filesBn
type FileSource struct {
FileName string `json:"filename"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment