diff --git a/store/types.go b/store/types.go index 34819c5da045d5e2dbea608510df96b969dad054..ed71e8b549e799746626f8b9e043523762d025f4 100644 --- a/store/types.go +++ b/store/types.go @@ -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"`