rpcsrv

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(network, address string, errChan chan error) error

Start JSON-RPC server on the specified network and address (see net.Listen(network, address)). Function returns error in case if net.Listen(network, address) failed, errChan is used to send errors that occur later.

func Stop

func Stop() error

Stop server

Types

type Builder

type Builder int

Builder can be exported via net/rpc and used to build DDC

func (*Builder) AppendDocumentPart

func (t *Builder) AppendDocumentPart(args *BuilderAppendDocumentPartArgs, notUsed *int) error

AppendDocumentPart to the specified builder slot

func (*Builder) AppendSignature

func (t *Builder) AppendSignature(args *BuilderAppendSignatureArgs, notUsed *int) error

AppendSignature to the specified builder slot

func (*Builder) Build

func (t *Builder) Build(args *BuilderBuildArgs, notUsed *int) error

Build DDC in the specified slot, should be called once after all data've been passed to the slot via calls to AppendDocumentPart and AppendSignature

func (*Builder) Drop

func (t *Builder) Drop(args *BuilderDropArgs, notUsed *int) error

Drop DDC in the specified slot

func (*Builder) GetDDCPart

func (t *Builder) GetDDCPart(args *BuilderGetDDCPartArgs, resp *BuilderGetDDCPartResp) error

GetDDCPart retrieves parts of the DDC in the specified slot successively, should be called after Build

func (*Builder) Register

func (t *Builder) Register(args *BuilderRegisterArgs, id *string) error

Register new builder slot and retrieve it's id

type BuilderAppendDocumentPartArgs

type BuilderAppendDocumentPartArgs struct {
	// ID of the builder slot to use
	ID string

	// Part of the original document
	Bytes []byte
}

BuilderAppendDocumentPartArgs used to pass data to Builder.AppendDocumentPart

type BuilderAppendSignatureArgs

type BuilderAppendSignatureArgs struct {
	// ID of the builder slot to use
	ID string

	// SignatureInfo describes the signature
	SignatureInfo ddc.SignatureInfo
}

BuilderAppendSignatureArgs used to pass data to Builder.AppendSignature

type BuilderBuildArgs

type BuilderBuildArgs struct {
	// ID of the builder slot to use
	ID string

	// CreationDate should be current date and time in format "2021.01.31 13:45:00 UTC+6"
	// converted to time zone of Nur-Sultan.
	CreationDate string

	// BuilderName would be embedded into DDC visualization
	BuilderName string

	// HowToVerify should provide instructions to verify DDC
	HowToVerify string
}

BuilderBuildArgs used to pass data to Builder.Build

type BuilderDropArgs

type BuilderDropArgs struct {
	// ID of the builder slot to use
	ID string
}

BuilderDropArgs used to pass data to Builder.GetDDCPart

type BuilderGetDDCPartArgs

type BuilderGetDDCPartArgs struct {
	// ID of the builder slot to use
	ID string

	// MaxPartSize should be used to limit the size of the part
	MaxPartSize int
}

BuilderGetDDCPartArgs used to pass data to Builder.GetDDCPart

type BuilderGetDDCPartResp

type BuilderGetDDCPartResp struct {
	// Part of DDC not larger than MaxPartSize
	Part []byte

	// IsFinal signals that there are no more parts to return
	IsFinal bool
}

BuilderGetDDCPartResp used to retrieve data from Builder.GetDDCPart

type BuilderRegisterArgs

type BuilderRegisterArgs struct {
	// Title of the document
	Title string

	// Description of the document
	Description string

	// FileName of the original document
	FileName string
}

BuilderRegisterArgs used to pass data to Builder.Register

type Extractor

type Extractor int

Extractor can be exported via net/rpc and used to extract embedded files from DDC

func (*Extractor) AppendDDCPart

func (t *Extractor) AppendDDCPart(args *ExtractorAppendDDCPartArgs, notUsed *int) error

AppendDDCPart to the specified extractor slot

func (*Extractor) Drop

func (t *Extractor) Drop(args *ExtractorDropArgs, notUsed *int) error

Drop DDC in the specified slot

func (*Extractor) GetDocumentPart

GetDocumentPart retrieves parts of the original document in the specified slot successively, should be called after Parse

func (*Extractor) GetSignature

GetSignature retrieves signatures that've benn embedded into DDC successively, should be called after Parse

func (*Extractor) Parse

func (t *Extractor) Parse(args *ExtractorParseArgs, documentFileName *string) error

Parse DDC in the specified slot, should be called after all parts of DDC've been transmitted via AppendDDCPart

func (*Extractor) Register

func (t *Extractor) Register(args *ExtractorRegisterArgs, id *string) error

Register new extraactor slot and retrieve it's id

type ExtractorAppendDDCPartArgs

type ExtractorAppendDDCPartArgs struct {
	// ID of the extractor slot to use
	ID string

	// Part of the DDC
	Part []byte
}

ExtractorAppendDDCPartArgs used to pass data to Extractor.AppendDDCPart

type ExtractorDropArgs

type ExtractorDropArgs struct {
	// ID of the extractor slot to use
	ID string
}

ExtractorDropArgs used to pass data to Extractor.GetDDCPart

type ExtractorGetDocumentPartArgs

type ExtractorGetDocumentPartArgs struct {
	// ID of the extractor slot to use
	ID string

	// MaxPartSize should be used to limit the size of the part
	MaxPartSize int

	// Rewind to the beginning of the document
	Rewind bool
}

ExtractorGetDocumentPartArgs used to pass data to Extractor.GetDocumentPart

type ExtractorGetDocumentPartResp

type ExtractorGetDocumentPartResp struct {
	// Part of the original document not larger than MaxPartSize
	Part []byte

	// IsFinal signals that there are no more parts to return
	IsFinal bool
}

ExtractorGetDocumentPartResp used to retrieve data from Extractor.GetDocumentPart

type ExtractorGetSignatureArgs

type ExtractorGetSignatureArgs struct {
	// ID of the extractor slot to use
	ID string
}

ExtractorGetSignatureArgs used to pass data to Extractor.GetSignature

type ExtractorGetSignatureResp

type ExtractorGetSignatureResp struct {
	// Signature bytes and file name
	Signature ddc.AttachedFile

	// IsFinal signals that there are no more signatures to return
	IsFinal bool
}

ExtractorGetSignatureResp used to retrieve data from Extractor.GetSignature

type ExtractorParseArgs

type ExtractorParseArgs struct {
	// ID of the extractor slot to use
	ID string
}

ExtractorParseArgs used to pass data to Extractor.Parse

type ExtractorRegisterArgs

type ExtractorRegisterArgs struct {
}

ExtractorRegisterArgs used to pass data to Extractor.Register

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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