problems

package
v2.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindInZip

func FindInZip(zipArchive *zip.ReadCloser, fileName string) (*io.ReadCloser, *zip.File, error)

FindInZip 搜索zip内的文件并打开(精确匹配)

func IsFileNotFoundError

func IsFileNotFoundError(e error) bool

IsFileNotFoundError check is file not found error

func NewFileNotFoundError

func NewFileNotFoundError(fileName string) error

NewFileNotFoundError new a file not found error

func PackProblems

func PackProblems(
	configuration *commonStructs.JudgeConfiguration,
	options *persistence.ProblemPackageOptions,
) error

PackProblems 执行题目数据表打包操作

func PackProblemsAsZip

func PackProblemsAsZip(options *persistence.ProblemPackageOptions) error

PackProblemsAsZip 执行题目数据表打包操作(打包成zip版本)

func ReadProblemGPGInfo

func ReadProblemGPGInfo(problemFile string) (string, error)

ReadProblemGPGInfo 读取题目携带的GPG信息

func ReadProblemGPGInfoZip

func ReadProblemGPGInfoZip(problemFile string) (string, error)

ReadProblemGPGInfoZip 读取题目携带的GPG信息(ZIP)

func ReadProblemInfo

func ReadProblemInfo(problemFile string, unpack, validate bool, workDir string) (*commonStructs.JudgeConfiguration, string, error)

ReadProblemInfo 读取题目信息

func ReadProblemInfoZip

func ReadProblemInfoZip(problemFile string, unpack, validate bool, workDir string) (*commonStructs.JudgeConfiguration, string, error)

ReadProblemInfoZip 读取题目信息(ZIP) workDir只在需要解压的时候才会用到

func UnZip

func UnZip(zipArchive *zip.ReadCloser, destDir string) error

UnZip do unzip

func WalkZip

func WalkZip(zipArchive *zip.ReadCloser, walkFunc func(file *zip.File) error) error

WalkZip walk in zip

Types

type FileNotFoundError

type FileNotFoundError struct {
	FileName string
}

FileNotFoundError file not found error

func (FileNotFoundError) Error

func (e FileNotFoundError) Error() string

Error get error string

type ProblemPackage

type ProblemPackage struct {
	Version         uint16 // (VER) Package Version
	CommitVersion   uint32 // (CMT) Commit Version
	ConfigSize      uint32 // (CSZ) Config JSON Text Size
	BodySize        uint32 // (BSZ) Result Body Size
	CertSize        uint16 // (PCSZ) Public Certificate Size
	SignSize        uint16 // (SSZ) Signature Size
	Certificate     []byte // Public Certificate
	Signature       []byte // Signature: SHA256(Configs + Body)
	Configs         []byte // Configs JSON
	BodyPackageFile string // Body package file
}

ProblemPackage 题目包-数据结构 ------------------------ |MAG|VER|CMT|CSZ|BSZ|PCSZ| Certificate |SSZ| Signature | Configs | Body ------------------------ | 2 | 2 | 4 | 4 | 4 | 2 | ... | 2 | ... ------------------------

Jump to

Keyboard shortcuts

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