@@ -22,6 +22,7 @@ const (
2222 SpaceStatusRemove
2323 SpaceStatusRemovePrepare
2424 SpaceStatusArchived
25+ SpaceStatusError
2526)
2627
2728var (
@@ -41,6 +42,7 @@ const (
4142 valueKey = "v"
4243 archiveSizeCompressedKey = "asc"
4344 archiveSizeUncompressedKey = "asu"
45+ errorKey = "err"
4446 diffMigrationKey = "diffState"
4547 diffVersionKey = "diffVersion"
4648
@@ -54,6 +56,7 @@ type IndexStorage interface {
5456 SetSpaceStatus (ctx context.Context , spaceId string , status SpaceStatus , recId string ) (err error )
5557 SpaceStatus (ctx context.Context , spaceId string ) (status SpaceStatus , err error )
5658 MarkArchived (ctx context.Context , spaceId string , compressedSize , uncompressedSize int64 ) (err error )
59+ MarkError (ctx context.Context , spaceId string , errString string ) (err error )
5760 LastRecordId (ctx context.Context ) (id string , err error )
5861 FindOldestInactiveSpace (ctx context.Context , olderThan time.Duration , skip int ) (spaceId string , err error )
5962
@@ -183,6 +186,15 @@ func (d *indexStorage) SetSpaceStatus(ctx context.Context, spaceId string, statu
183186 return tx .Commit ()
184187}
185188
189+ func (d * indexStorage ) MarkError (ctx context.Context , spaceId string , errString string ) (err error ) {
190+ _ , err = d .spaceColl .UpdateId (ctx , spaceId , query .ModifyFunc (func (a * anyenc.Arena , v * anyenc.Value ) (result * anyenc.Value , modified bool , err error ) {
191+ v .Set (statusKey , a .NewNumberInt (int (SpaceStatusError )))
192+ v .Set (errorKey , a .NewString (errString ))
193+ return v , true , nil
194+ }))
195+ return err
196+ }
197+
186198func (d * indexStorage ) MarkArchived (ctx context.Context , spaceId string , compressedSize , uncompressedSize int64 ) (err error ) {
187199 _ , err = d .spaceColl .UpdateId (ctx , spaceId , query .ModifyFunc (func (a * anyenc.Arena , v * anyenc.Value ) (result * anyenc.Value , modified bool , err error ) {
188200 v .Set (archiveSizeCompressedKey , a .NewNumberInt (int (compressedSize )))
0 commit comments