Skip to content

sysadmin.rclone #

a sal to work with rclone

Rclone is this incredible swiss army knive to deal with S3 storage servers.

Example

import freeflowuniverse.crystallib.osal.rclone

fn main() {
    do() or { panic(err) }
}

fn do() ! {
    mut z:=rclone.new()!

    // name      string            @[required]
    // cmd       string            @[required]
    // cmd_file  bool  //if we wanna force to run it as a file which is given to bash -c  (not just a cmd in rclone)
    // test      string
    // test_file bool
    // after     []string
    // env       map[string]string
    // oneshot   bool
    p:=z.new(
        name:'test'
        cmd:'/bin/bash'
    )!

}

protocol defined in

sal on top of https://github.com/threefoldtech/rclone/tree/master

https://github.com/threefoldtech/rclone/blob/master/docs/protocol.md

fn configure #

fn configure() !

will look for personal configuration file in ~/hero/config . this file is in heroscript format and will have all required info to configure rclone

 !!config.s3server_define
     name:'tf_write_1'
     description:'ThreeFold Read Write Repo 1
     keyid:'003e2a7be6357fb0000000001'
     keyname:'tfrw'
     appkey:'K003UsdrYOZou2ulBHA8p4KLa/dL2n4'
     url:''

fn new #

fn new() !Zinit

pub fn start() ! { console.print_header(' rclone start') initd_proc_get(delete: true, start: true)! }

struct ZProcessNewArgs #

@[params]
struct ZProcessNewArgs {
pub mut:
	name      string @[required]
	cmd       string @[required]
	cmd_file  bool // if we wanna force to run it as a file which is given to bash -c  (not just a cmd in rclone)
	test      string
	test_file bool
	after     []string
	env       map[string]string
	oneshot   bool
}

struct Zinit #

@[heap]
struct Zinit {
pub mut:
	processes map[string]ZProcess
	path      pathlib.Path
	pathcmds  pathlib.Path
	pathtests pathlib.Path
}

fn (Zinit) new #

fn (mut rclone Zinit) new(args_ ZProcessNewArgs) !ZProcess