carves

package module
v0.0.0-...-4060db5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusQueried for queried carves that did not hit nodes yet
	StatusQueried string = "QUERIED"
	// StatusScheduled for initialized carves
	StatusScheduled string = "SCHEDULED"
	// StatusInProgress for carves that are on-going
	StatusInProgress string = "IN PROGRESS"
	// StatusCompleted for carves that finalized
	StatusCompleted string = "COMPLETED"
)

Variables

View Source
var (
	// CompressionHeader to detect the usage of compressed carves (zstd header)
	CompressionHeader = []byte{0x28, 0xb5, 0x2f, 0xfd}
)

Functions

This section is empty.

Types

type CarveResult

type CarveResult struct {
	Size int64
	File string
}

CarveResult holds metadata related to a carve

type CarvedBlock

type CarvedBlock struct {
	gorm.Model
	RequestID   string `gorm:"index"`
	SessionID   string `gorm:"index"`
	Environment string
	BlockID     int
	Data        string
	Size        int
}

CarvedBlock to store each block from a carve

type CarvedFile

type CarvedFile struct {
	gorm.Model
	CarveID         string `gorm:"unique;index"`
	RequestID       string
	SessionID       string
	QueryName       string
	UUID            string `gorm:"index"`
	Environment     string
	Path            string
	CarveSize       int
	BlockSize       int
	TotalBlocks     int
	CompletedBlocks int
	Status          string
	CompletedAt     time.Time
}

CarvedFile to keep track of carved files from nodes

type Carves

type Carves struct {
	DB *gorm.DB
}

Carves to handle file carves from nodes

func CreateFileCarves

func CreateFileCarves(backend *gorm.DB) *Carves

CreateFileCarves to initialize the carves struct and tables

func (*Carves) Archive

func (c *Carves) Archive(sessionid, path string) (*CarveResult, error)

Archive to convert finalize a completed carve and create a file ready to download

func (*Carves) ChangeStatus

func (c *Carves) ChangeStatus(status, sessionid string) error

ChangeStatus to change the status of a carve

func (*Carves) CheckCarve

func (c *Carves) CheckCarve(sessionid, requestid string) bool

CheckCarve to verify a session belong to a carve

func (*Carves) CheckCompression

func (c *Carves) CheckCompression(block CarvedBlock) (bool, error)

CheckCompression to verify if the blocks are compressed using zstd

func (*Carves) CompleteBlock

func (c *Carves) CompleteBlock(sessionid string) error

CompleteBlock to increase one block for a carve

func (*Carves) Completed

func (c *Carves) Completed(sessionid string) bool

Completed to check if a carve is completed FIXME return error maybe?

func (*Carves) CreateBlock

func (c *Carves) CreateBlock(block CarvedBlock) error

CreateBlock to create a new block for a carve

func (*Carves) CreateCarve

func (c *Carves) CreateCarve(carve CarvedFile) error

CreateCarve to create a new carved file for a node

func (*Carves) Delete

func (c *Carves) Delete(carveid string) error

Delete to delete a carve by id

func (*Carves) DeleteBlocks

func (c *Carves) DeleteBlocks(sessionid string) error

DeleteBlocks to delete all blocks by session id

func (*Carves) GetBlocks

func (c *Carves) GetBlocks(sessionid string) ([]CarvedBlock, error)

GetBlocks to get a carve by session id

func (*Carves) GetByCarve

func (c *Carves) GetByCarve(carveid string) (CarvedFile, error)

GetByCarve to get a carve by carve id

func (*Carves) GetByQuery

func (c *Carves) GetByQuery(name string) ([]CarvedFile, error)

GetByQuery to get a carve by query name

func (*Carves) GetByRequest

func (c *Carves) GetByRequest(requestid string) ([]CarvedFile, error)

GetByRequest to get a carve by request id

func (*Carves) GetBySession

func (c *Carves) GetBySession(sessionid string) (CarvedFile, error)

GetBySession to get a carve by session id

func (*Carves) GetNodeCarves

func (c *Carves) GetNodeCarves(uuid string) ([]CarvedFile, error)

GetNodeCarves to get all the carves for a given node

func (*Carves) InitCarve

func (c *Carves) InitCarve(req types.CarveInitRequest, sessionid string) error

InitCarve to initialize an scheduled carve

type MappedCarves

type MappedCarves map[string][]CarvedFile

MappedCarves to pass carves by query name / Request ID

type QueriedCarve

type QueriedCarve struct {
	Name    string
	Path    string
	Status  string
	Creator string
}

QueriedCarve to be used to display the carves in a table

Jump to

Keyboard shortcuts

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