Documentation ¶
Index ¶
- Constants
- Variables
- type CarveResult
- type CarvedBlock
- type CarvedFile
- type Carves
- func (c *Carves) Archive(sessionid, path string) (*CarveResult, error)
- func (c *Carves) ChangeStatus(status, sessionid string) error
- func (c *Carves) CheckCarve(sessionid, requestid string) bool
- func (c *Carves) CheckCompression(block CarvedBlock) (bool, error)
- func (c *Carves) CompleteBlock(sessionid string) error
- func (c *Carves) Completed(sessionid string) bool
- func (c *Carves) CreateBlock(block CarvedBlock) error
- func (c *Carves) CreateCarve(carve CarvedFile) error
- func (c *Carves) Delete(carveid string) error
- func (c *Carves) DeleteBlocks(sessionid string) error
- func (c *Carves) GetBlocks(sessionid string) ([]CarvedBlock, error)
- func (c *Carves) GetByCarve(carveid string) (CarvedFile, error)
- func (c *Carves) GetByQuery(name string) ([]CarvedFile, error)
- func (c *Carves) GetByRequest(requestid string) ([]CarvedFile, error)
- func (c *Carves) GetBySession(sessionid string) (CarvedFile, error)
- func (c *Carves) GetNodeCarves(uuid string) ([]CarvedFile, error)
- func (c *Carves) InitCarve(req types.CarveInitRequest, sessionid string) error
- type MappedCarves
- type QueriedCarve
Constants ¶
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 ¶
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 ¶
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 ¶
Carves to handle file carves from nodes
func CreateFileCarves ¶
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 ¶
ChangeStatus to change the status of a carve
func (*Carves) CheckCarve ¶
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 ¶
CompleteBlock to increase one block for a carve
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) DeleteBlocks ¶
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
type MappedCarves ¶
type MappedCarves map[string][]CarvedFile
MappedCarves to pass carves by query name / Request ID