Skip to content

Commit

Permalink
Offline support – Alpha (#196)
Browse files Browse the repository at this point in the history
* Textile background sync and queue logic

* Add file pinning to textile synchronization

* Format

* Update mocks

* Remove unused code

* Task queue optimizations and reduce amount of logs

* Fix max parallel tasks

* Add queue dedupe in task queue

* Add task queue tests

* Fix race condition
  • Loading branch information
dmerrill6 authored Oct 1, 2020
1 parent 84a2b00 commit 81dd1e5
Show file tree
Hide file tree
Showing 28 changed files with 1,397 additions and 820 deletions.
23 changes: 1 addition & 22 deletions core/space/services/services_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,11 @@ func (s *Space) ToggleBucketBackup(ctx context.Context, bucketName string, bucke
return err
}

b, err := s.tc.GetBucket(ctx, bucketName, nil)
_, err = s.tc.GetBucket(ctx, bucketName, nil)
if err != nil {
return err
}

if bucketBackup == true {
_, err = s.tc.BackupBucket(ctx, b)
if err != nil {
return err
}
} else {
_, err = s.tc.UnbackupBucket(ctx, b)
if err != nil {
return err
}
}

return nil
}

Expand Down Expand Up @@ -663,15 +651,6 @@ func (s *Space) addFile(ctx context.Context, sourcePath string, targetPath strin
return domain.AddItemResult{}, err
}

if s.tc.IsBucketBackup(ctx, b.Slug()) && !s.tc.IsMirrorFile(ctx, targetPathBucket, b.Slug()) {
f.Seek(0, io.SeekStart)

err = s.tc.BackupFileWithReader(ctx, b, targetPathBucket, f)
if err != nil {
return domain.AddItemResult{}, err
}
}

fi, err := f.Stat()
var fileSize int64 = 0
if err == nil {
Expand Down
10 changes: 0 additions & 10 deletions core/space/space_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,6 @@ func TestService_AddItems_FilesOnly(t *testing.T) {
"Slug",
).Return("personal")

textileClient.On(
"IsBucketBackup",
mock.Anything, mock.Anything,
).Return(false)

mockPath.On("String").Return("hash")

for _, f := range testSourcePaths {
Expand Down Expand Up @@ -475,11 +470,6 @@ func TestService_AddItems_Folder(t *testing.T) {
"Slug",
).Return("personal")

textileClient.On(
"IsBucketBackup",
mock.Anything, mock.Anything,
).Return(false)

ch, res, err := sv.AddItems(context.Background(), testSourcePaths, bucketPath, "")

assert.Nil(t, err)
Expand Down
291 changes: 0 additions & 291 deletions core/textile/backup.go

This file was deleted.

Loading

0 comments on commit 81dd1e5

Please sign in to comment.