github.com/apptainer/singularity@v3.1.1+incompatible/internal/pkg/runtime/engines/oci/rpc/client/client.go (about) 1 // Copyright (c) 2018, Sylabs Inc. All rights reserved. 2 // This software is licensed under a 3-clause BSD license. Please consult the 3 // LICENSE.md file distributed with the sources of this project regarding your 4 // rights to use or distribute this software. 5 6 package client 7 8 import ( 9 "os" 10 11 ociargs "github.com/sylabs/singularity/internal/pkg/runtime/engines/oci/rpc" 12 args "github.com/sylabs/singularity/internal/pkg/runtime/engines/singularity/rpc" 13 client "github.com/sylabs/singularity/internal/pkg/runtime/engines/singularity/rpc/client" 14 ) 15 16 // RPC holds the state necessary for remote procedure calls. 17 type RPC struct { 18 client.RPC 19 } 20 21 // MkdirAll calls the mkdir RPC using the supplied arguments. 22 func (t *RPC) MkdirAll(path string, perm os.FileMode) (int, error) { 23 arguments := &args.MkdirArgs{ 24 Path: path, 25 Perm: perm, 26 } 27 var reply int 28 err := t.Client.Call(t.Name+".MkdirAll", arguments, &reply) 29 return reply, err 30 } 31 32 // Symlink calls the mkdir RPC using the supplied arguments. 33 func (t *RPC) Symlink(old string, new string) (int, error) { 34 arguments := &ociargs.SymlinkArgs{ 35 Old: old, 36 New: new, 37 } 38 var reply int 39 err := t.Client.Call(t.Name+".Symlink", arguments, &reply) 40 return reply, err 41 } 42 43 // Touch calls the touch RPC using the supplied arguments. 44 func (t *RPC) Touch(path string) (int, error) { 45 arguments := &ociargs.TouchArgs{ 46 Path: path, 47 } 48 var reply int 49 err := t.Client.Call(t.Name+".Touch", arguments, &reply) 50 return reply, err 51 }