writer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NativeProvider    string = "native"
	ContainerProvider string = "container"
	BaseProvider      string = "native"

	PdfEngine     string = "loEngine.odt"
	ZugferdEngine string = "mustang-cli.jar"
	BaseEngine    string = "none"

	BaseKind    WriterKind = "base"
	PdfKind     WriterKind = "pdf"
	ZugferdKind WriterKind = "zugferd"

	PdfExecutable     string = "soffice"
	ZugferdExecutable string = "java"
)
View Source
const (
	FileMask      = 0644
	DirectoryMask = 0755
	PollIntervall = 200 * time.Millisecond
)

Variables

This section is empty.

Functions

func CheckHeartbeat

func CheckHeartbeat(heartbeatFile string, timeout time.Duration) (bool, error)

func Check verifies the heartbeat file. It returns 'true' if everything is okay, and 'false', along with an error, if the engine is stuck.

func CopyFile

func CopyFile(src, dst string) error

Helper-func CopyFile: copies a file from src to dst

func Register

func Register(kind WriterKind, factory FactoryFunc)

Register is called by the engines to sign up.

Types

type AbstractWriter

type AbstractWriter struct {
	Provider   string
	Engine     string
	Executable string
	TimeOut    time.Duration
	Heartbeat  time.Duration

	JobArtefactsPath string

	JobJsonFile   string
	JobResultFile string
	JobTmpFile    string
}

AbstractWriter is Base-Struct for spezialized writer, should never be instantiated

func (*AbstractWriter) Finalize

func (a *AbstractWriter) Finalize(rJob *job.RenderJob, rInput *RenderInput, sourcePath string, lastStep bool) (*RenderOutput, error)

func (*AbstractWriter) Prepare

func (a *AbstractWriter) Prepare(rJob *job.RenderJob, rInput *RenderInput) error

func (*AbstractWriter) WriteJob

func (a *AbstractWriter) WriteJob(rJob *job.RenderJob) error

type FactoryFunc

type FactoryFunc func(provider string, engine string, timeout time.Duration, heartbeat time.Duration) (Writer, error)

Registry for writers: The shared blueprint for all factory functions

type JobRPCResponse added in v0.2.0

type JobRPCResponse struct {
	JobID       string           `json:"job_id"`
	OutputFile  OutputFileType   `json:"output_file"`           // Hauptergebnis (PDF, XML, etc.)
	Attachments []OutputFileType `json:"attachments,omitempty"` // Optionale Zusatzdokumente/Belege
}

JobRPCResponse bildet das Gesamtergebnis des Jobs ab.

type OutputFileType added in v0.2.0

type OutputFileType struct {
	Name     string `json:"name"`      // "factur-x.xml", "rechnung.pdf", ...
	MimeType string `json:"mime_type"` // "application/pdf", "text/xml", ...
	Size     int64  `json:"size"`      // Filesize in Bytes

	// Entweder Direct Payload (für normale/kleine Dateien)...
	Data []byte `json:"data,omitempty"` // Wird im JSON automatisch Base64-kodiert

	// ...oder Referenz für große Dateien (wird später genutzt)
	URL string `json:"url,omitempty"` // Download-URL oder Pfad
}

---------------------------- OutputFileType beschreibt eine generierte Datei oder einen Anhang.

type RenderInput

type RenderInput struct {
	Provider      string
	BytesToRender []byte
	ParPath       string
	OttPath       string
	PdfPath       string
	XMLPath       string
	ArtefactsPath string
	RootPath      string
	Attachments   []string
	OutputPath    string
}

type RenderOutput

type RenderOutput struct {
	JobID      string
	OutputPath string
	ParPath    string
	StatusPath string
	ODTPath    string
	FXPath     string
	PDFPath    string
}

type Writer

type Writer interface {
	Render(ctx context.Context, rJob *job.RenderJob, rInput *RenderInput, finalize bool) (*RenderOutput, error)
	Prepare(job *job.RenderJob, input *RenderInput) error
	Finalize(rJob *job.RenderJob, rInput *RenderInput, sourcePath string, lastStep bool) (*RenderOutput, error)
}

func CreateWriter

func CreateWriter(kind WriterKind, provider string, engine string, timeout time.Duration, heartbeat time.Duration) (Writer, error)

CreateWriter is now the universal factory that the orchestrator calls.

type WriterKind

type WriterKind string

Working Env Definition

Jump to

Keyboard shortcuts

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