importinspection

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSuggestedChunkSize is the recommended chunk payload size (25MB).
	DefaultSuggestedChunkSize = chunkedupload.DefaultSuggestedChunkSize
	// DefaultMaxChunkSize is the maximum allowed single chunk payload (32MB).
	DefaultMaxChunkSize = chunkedupload.DefaultMaxChunkSize
	// DefaultSessionTTL is the duration after which an inactive import session expires.
	DefaultSessionTTL = chunkedupload.DefaultSessionTTL
)

Variables

View Source
var (
	// ErrSessionNotFound is returned when an import session token is not found or has expired.
	ErrSessionNotFound = chunkedupload.ErrSessionNotFound
	// ErrInvalidTotalSize is returned when the specified total file size is non-positive.
	ErrInvalidTotalSize = chunkedupload.ErrInvalidTotalSize
	// ErrEmptyChunkData is returned when an uploaded chunk contains empty data payload.
	ErrEmptyChunkData = chunkedupload.ErrEmptyChunkData
	// ErrInvalidOffset is returned when the chunk byte offset is invalid.
	ErrInvalidOffset = chunkedupload.ErrInvalidOffset
	// ErrChunkSizeTooLarge is returned when a single chunk exceeds the maximum permitted size limit.
	ErrChunkSizeTooLarge = chunkedupload.ErrChunkSizeTooLarge
)

Functions

func ValidateAndExtractMetadata

func ValidateAndExtractMetadata(filePath string) (*inspectionmetadata.HeaderMetadata, *typedmap.ReadonlyTypedMap, error)

ValidateAndExtractMetadata validates that the file at the given path is a valid KHI v6 binary file and extracts the header metadata and general metadata map needed by InspectionTaskServer.

Types

type ByteRange

type ByteRange = chunkedupload.ByteRange

ByteRange represents an uploaded byte interval [Start, End).

type FinalizedImport

type FinalizedImport struct {
	InspectionID   string
	InspectionName string
	FileSize       int64
}

FinalizedImport represents the result of a completed and validated inspection import.

type ImportSession

type ImportSession = chunkedupload.ChunkSession

ImportSession represents an in-progress chunked upload session.

type ImportSessionManager

type ImportSessionManager struct {
	// contains filtered or unexported fields
}

ImportSessionManager manages the lifecycle of chunked upload sessions and registers imported inspections.

func NewImportSessionManager

func NewImportSessionManager(server *coreinspection.InspectionTaskServer, ioConfig *inspectioncore.IOConfig) *ImportSessionManager

NewImportSessionManager creates a new ImportSessionManager instance.

func (*ImportSessionManager) AbortSession

func (m *ImportSessionManager) AbortSession(token string) error

AbortSession closes and deletes the temporary upload file and removes the session.

func (*ImportSessionManager) Close

func (m *ImportSessionManager) Close()

Close stops the background session cleaner and releases resources.

func (*ImportSessionManager) CompleteSession

func (m *ImportSessionManager) CompleteSession(token string) (*FinalizedImport, error)

CompleteSession finalizes the session, validates the uploaded .khi file, moves it to the permanent destination, and registers the imported inspection in the InspectionTaskServer.

func (*ImportSessionManager) StartSession

func (m *ImportSessionManager) StartSession(fileName string, totalSize int64) (*ImportSession, error)

StartSession initializes a new upload session and creates a temporary file to store incoming chunks.

func (*ImportSessionManager) SuggestedChunkSize

func (m *ImportSessionManager) SuggestedChunkSize() int64

SuggestedChunkSize returns the recommended chunk size in bytes.

func (*ImportSessionManager) WriteChunk

func (m *ImportSessionManager) WriteChunk(token string, offset int64, data []byte) (int64, error)

WriteChunk writes a chunk of data at the specified byte offset to the session's temporary file.

Jump to

Keyboard shortcuts

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