graboid

package module
v0.0.0-...-65c74a7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: GPL-3.0 Imports: 23 Imported by: 0

README

graboid

Graboid is a GUI that copies files from one storage to another. It does some file identification using Siegfried or FITS via a FITSServlet.

It creates a UUIDv4 and calculates hash sums.

Output is written to a CSV file when using Siegfried or to an XML file using FITS.

Graboid is work in progress and should not be used in productive environments.

CSV schema using Siegfried

Filename, Size in Byte, Registry, PUID, Name, Version, MIME, Byte Match, Identification Note, Hash sum, UUID

XML output using FITSServlet

work in progress

Documentation

Index

Constants

View Source
const Version = "0.1.0"

Version string

Variables

This section is empty.

Functions

func CreateOutDir

func CreateOutDir(outDir string)

CreateOutDir creates the output directory

func CreateUUID

func CreateUUID() string

GetUUID returns a UUID v4 as a string

func FITSGet

func FITSGet(fitsserver string, filepath string)

FITSGet sends a file via GET to a FITS servlet

func FITSPost

func FITSPost(fitsserver string, pathfile string) []byte

FITSPost sends a file via POST to a FITS servlet

func GetSupportedHashes

func GetSupportedHashes() []string

GetSupportedHashes returns hash algos supported by graboid

func Hashit

func Hashit(inFile string, hashalg string) []byte

Hashit hashes a file using the provided hash algorithm

func ProcessFITS

func ProcessFITS(fitsConnect string, rootDir string, toDir string, g Graboid, hashDigest string)

ProcessFiles processes files that are in the passed rootDir. It uses the hashDigest to calculate hash sums. func ProcessFiles(fitsConnect string, rootDir string, hashDigest string) map[string][]byte {

func ProcessSiegfried

func ProcessSiegfried(rootDir string, toDir string, hashDigest string)

ProcessSiegfried processes files using siegfried that are in the passed rootDir. It uses the hashDigest to calculate hash sums.

func WriteConfig

func WriteConfig() error

WriteConfig creates an empty configuration file for graboid

func WriteDC

func WriteDC()

WriteDC writes all non-technical metadata to a Dublin Core xml

func WritePremis

func WritePremis()

WritePremis writes all technical metadata to a PREMIS xml

Types

type Accession

type Accession struct {
	Ingestnote      string    `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 ingest_note,omitempty"`
	Ingesttime      time.Time `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 ingest_time,omitempty"`
	Sourcenote      string    `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 source_note,omitempty"`
	Additionalnotes string    `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 additional_notes,omitempty"`
	Folder          Folder    `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 folder"`
	Number          string    `xml:"number,attr,omitempty"`
}

func (*Accession) MarshalXML

func (t *Accession) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Accession) UnmarshalXML

func (t *Accession) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Collection

type Collection struct {
	Accession Accession `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 accession"`
	Name      string    `xml:"name,attr,omitempty"`
	Number    string    `xml:"number,attr,omitempty"`
}

type Config

type Config struct {
	FITSServer string
	FITSPort   string
	UUIDPrefix string
	Logging    bool
	LogFile    string
}

Config type defines the configuration struct for graboid

func ReadConfig

func ReadConfig(configPath string) (Config, error)

ReadConfig reads a configuration file

type DublinCore

type DublinCore struct {
	Identifier  string
	Format      string
	Type        string
	Language    string
	Title       string
	Subject     string
	Coverage    string
	Description string
	Creator     string
	Publisher   string
	Contributor string
	Rights      string
	Source      string
	Relation    string
	Date        string
}

DublinCore is a struct that holds the 15 core elements

type File

type File struct {
	Item         string    `xml:",any"`
	MD5          string    `xml:"MD5,attr,omitempty"`
	SHA256       string    `xml:"SHA256,attr,omitempty"`
	CRC32        string    `xml:"CRC32,attr,omitempty"`
	Lastmodified time.Time `xml:"last_modified,attr"`
	Name         string    `xml:"name,attr"`
	Size         int       `xml:"size,attr"`
	Hidden       bool      `xml:"hidden,attr,omitempty"`
}

func (*File) MarshalXML

func (t *File) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*File) UnmarshalXML

func (t *File) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Folder

type Folder struct {
	Description  QualifiedElement `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 description"`
	Title        QualifiedElement `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 title"`
	File         File             `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 file"`
	Folder       *Folder          `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 folder"`
	Note         string           `xml:"https://codeberg.org/steffenfritz/graboid/schema/graboid-1-1 note"`
	Lastmodified time.Time        `xml:"last_modified,attr,omitempty"`
	Name         string           `xml:"name,attr"`
	Hidden       bool             `xml:"hidden,attr,omitempty"`
}

func (*Folder) MarshalXML

func (t *Folder) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Folder) UnmarshalXML

func (t *Folder) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Graboid

type Graboid struct {
	MainInfo MainInfo
	DC       DublinCore
}

Graboid is a struct that holds all types used within a session

type MainInfo

type MainInfo struct {
	Name            string
	AccessioNumber  string
	CollectionTitle string
	AccessionFrom   string
	AccessionTo     string
}

MainInfo is a struct that holds mail graboid session info

type QualifiedElement

type QualifiedElement struct {
	Value     string `xml:",chardata"`
	Qualifier string `xml:"qualifier,attr,omitempty"`
}

type SiegfriedOutput

type SiegfriedOutput struct {
}

SiegfriedOutput is a struct that holds info about a single file

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL