Class: Backup::Storage::GoogleDrive

Inherits:
Base
  • Object
show all
Includes:
Storage::Cycler
Defined in:
lib/backup-googledrive.rb

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, storage_id = nil) ⇒ GoogleDrive

Creates a new instance of the storage object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/backup-googledrive.rb', line 33

def initialize(model, storage_id = nil)
  super
  @rclone_exec    ||= "/usr/bin/rclone"
  @rclone_config  ||= "/root/.config/rclone/rclone.conf"
  @rclone_drive   ||= "remote"
  @path           ||= ""
  @chunk_size     ||= 8388608
  @max_retries    ||= 3
  @cmd_base         = "#{rclone_exec} --config #{rclone_config} --retries #{max_retries} --drive-chunk-size=#{chunk_size} --drive-use-trash=false"
  path.sub!(/^\//, "")
end

Instance Attribute Details

#chunk_sizeObject

Chunk size, specified in bytes (power of two, i.e. 8M = 8 * 1024 * 1024)



23
24
25
# File 'lib/backup-googledrive.rb', line 23

def chunk_size
  @chunk_size
end

#max_retriesObject

Number of times to retry failed operations.

Default: 10



29
30
31
# File 'lib/backup-googledrive.rb', line 29

def max_retries
  @max_retries
end

#rclone_configObject

Path to the rclone config file



15
16
17
# File 'lib/backup-googledrive.rb', line 15

def rclone_config
  @rclone_config
end

#rclone_driveObject

Name of the rclone remote drive



19
20
21
# File 'lib/backup-googledrive.rb', line 19

def rclone_drive
  @rclone_drive
end

#rclone_execObject

Path to the rclone executable



11
12
13
# File 'lib/backup-googledrive.rb', line 11

def rclone_exec
  @rclone_exec
end