Narwhal.Lib/Narwhal.cs
/// <summary>
/// Saves the volume as a tar zip
/// </summary>
/// <param name="volumeName">named volume to save</param>
/// <param name="tarName">the name of the tar zip</param>
/// <param name="location">the directory to save to</param>
/// <returns></returns>
Saves the volume as a tar zip
Saves the volume as a tar zip
public IEnumerable<string> Save(string volumeName, string tarName = "data", string location = "./")
        {
            var errors = new List<string>();
            var name = "narwhal-mounting-" + Guid.NewGuid();
            var zippedName = $"{tarName}.tar.gz";
            try
            {
                StartContainer(name, volumeName, "alpine");
                try
                {
                    ZipVolume(name, zippedName);
                    CopyToHost(name, zippedName, location);
                }
                catch (Exception e)
                {
                    errors.Add(e.Message);
                }
                finally
                {
                    KillContainer(name);
                    RemoveContainer(name);
                }
            }
            catch (Exception e)
            {
                errors.Add(e.Message);
            }
            return errors;
        }
public IEnumerable < string > Save ( string volumeName , string tarName = " " , string location = " " ) { var errors = new List < string > ( ) ; var name = " " + Guid . NewGuid ( ) ; var zippedName = $" { tarName } .tar.gz " ; try { StartContainer ( name , volumeName , " " ) ; try { ZipVolume ( name , zippedName ) ; CopyToHost ( name , zippedName , location ) ; } catch ( Exception e ) { errors . Add ( e . Message ) ; } finally { KillContainer ( name ) ; RemoveContainer ( name ) ; } } catch ( Exception e ) { errors . Add ( e . Message ) ; } return errors ; }
Saves the volume as a tar zip
Saves the volume as a tar zip
None
volumeName
string
named volume to save
named volume to save
tarName
string
the name of the tar zip
the name of the tar zip
location
string
the directory to save to
the directory to save to