st33

package
v0.0.0-...-8b27293 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0, Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

bns project bns.go

Index

Constants

View Source
const (
	Bib      string = "BB" // Biblio
	Abs      string = "AB" // Abstrcat
	Cla      string = "CL" // Claims
	Dra      string = "DR" // Drawing
	Amd      string = "AM" // Amendement
	Des      string = "DE" // Description
	Srp      string = "SR" // Search Report
	Dna      string = "DN" // DNA
	Aci      string = "AC" // Application citation
	Max_page int    = 1000 // maximum subpage
)
View Source
const (
	ToFile int    = 1
	ToS3   int    = 2
	TIFF   string = "pxi/tiff"
)
View Source
const (
	DATval string = "datval"
	CONval string = "conval"
	DIRval string = "dir_datval"
)
View Source
const (
	ST33RAMReader     string = "RAM"
	ST33FILEReader    string = "FILE"
	PartiallyUploaded string = "Partially Uploaded"
	Started           string = "Started"
	FullyUploaded     string = "Fully Uploaded"
	FullyUploaded2    string = "Fully Uploaded with some input data inconsistency"
	TwoGB             int64  = 2 * 1024 * 1024
	LOOP              int    = 10 /* number of loop to skip bad records */
)
View Source
const (
	Tiff_header_size = 160 // 0xA0

)

Variables

This section is empty.

Functions

func BuildConvalArray

func BuildConvalArray(inputFile string) (*[]Conval, error)

func BuildDirectoryArray

func BuildDirectoryArray(inputFile string) (*[]Directory, error)

func BuildUsermd

func BuildUsermd(v Conval) (map[string]string, error)

func CheckST33Length

func CheckST33Length(v *Conval, r *St33Reader, buf []byte) error

func CopyObject

func CopyObject(key string, svc *s3.S3, frombucket string, tobucket string) error

func CopyObjects

func CopyObjects(key string, pages int, svc *s3.S3, frombucket string, tobucket string)

func GetMagic

func GetMagic(id string) string

Generate a magic number for bucket location

func GetOrientation

func GetOrientation(rotation_code []byte) uint16

image orientation

func Getuint16

func Getuint16(in []byte) uint16

func Getuint32

func Getuint32(in []byte) uint32

func IsST33Blob

func IsST33Blob(buf []byte, k int64) bool

func NewPxiBlob

func NewPxiBlob(key string, records int) *pxiBlob

func RewindST33

func RewindST33(v Conval, r *St33Reader, diff int)

func SetTiffImageCompression

func SetTiffImageCompression(buffer *bytes.Buffer, enc binary.ByteOrder) error

12 bytes

func SetTiffImageLength

func SetTiffImageLength(buffer *bytes.Buffer, enc binary.ByteOrder, width []byte) error

12 bytes

func SetTiffImageOrientation

func SetTiffImageOrientation(buffer *bytes.Buffer, enc binary.ByteOrder, rotationCode []byte) error

func SetTiffImagePhotometric

func SetTiffImagePhotometric(buffer *bytes.Buffer, enc binary.ByteOrder) error

12 bytes

func SetTiffImageResolutionUnit

func SetTiffImageResolutionUnit(buffer *bytes.Buffer, resolution []byte, enc binary.ByteOrder) error

12 bytes

func SetTiffImageStripByteCount

func SetTiffImageStripByteCount(buffer *bytes.Buffer, enc binary.ByteOrder, totalLength uint32) error

12 bytes

func SetTiffImageStripOffset

func SetTiffImageStripOffset(buffer *bytes.Buffer, enc binary.ByteOrder) error

12 bytes

func SetTiffImageWidth

func SetTiffImageWidth(buffer *bytes.Buffer, enc binary.ByteOrder, width []byte) error

12 bytes

func SetTiffImageXresolution

func SetTiffImageXresolution(buffer *bytes.Buffer, enc binary.ByteOrder) error

func SetTiffImageYresolution

func SetTiffImageYresolution(buffer *bytes.Buffer, enc binary.ByteOrder) error

func SetTiffMagicNumber

func SetTiffMagicNumber(buffer *bytes.Buffer, enc binary.ByteOrder) error

func SkipST33

func SkipST33(v Conval, r *St33Reader, diff int)

func ToFilesV1

func ToFilesV1(ifile string, odir string, bdir string, test bool) (int, int, int, int, error)

func WriteImgToFile

func WriteImgToFile(pathname string, img *bytes.Buffer) error

func WriteUsermd

func WriteUsermd(metad map[string]string, pathname string) error

Types

type Conval

type Conval struct {
	PxiId     string `json:"pxiId"`
	PubDate   string `json:"pubDate"`
	ScanDate  string `json:"scanDate"`
	Pages     uint32 `json:"numPages"`
	Records   int    `json:"numRecords,omitempty"`
	DocSize   uint32 `json:"docSize"`
	Status    string `json:"status"`
	Revisory  string `json:"revisory"`
	Copyright string `json:"copyright"`
	Quality   string `json:"quality,omitempty"`
}

func (*Conval) New

func (con *Conval) New(buf []byte, l int) int

type Directory

type Directory struct {
	PxiId   string
	Pages   uint32
	Records uint32
	Size    uint32
}

func (*Directory) New

func (dir *Directory) New(buf []byte, l int) int

type PutS3Response

type PutS3Response struct {
	Bucket string
	Key    string
	Size   int
	Error  S3Error
}

type PxiImg

type PxiImg struct {
	PxiId    []byte
	PageNum  []byte
	RefNum   []byte
	Img      *bytes.Buffer
	DataType []byte
	NumPages []byte
}

func GetPage

func GetPage(r *St33Reader, v Conval, cp int) (*PxiImg, int, error, error)

func NewPxiImg

func NewPxiImg() *PxiImg

return the address of aPxiImg structure

func (*PxiImg) BuildTiffImage

func (image *PxiImg) BuildTiffImage(r *St33Reader, v Conval, cp int) (int, error, error)

func (*PxiImg) BuildTiffImageV2

func (image *PxiImg) BuildTiffImageV2(r *St33Reader, v Conval, cp int) (int, error, error)

func (*PxiImg) GetDataType

func (image *PxiImg) GetDataType() []byte

func (*PxiImg) GetImage

func (image *PxiImg) GetImage() *bytes.Buffer

Return a TIFF image

func (*PxiImg) GetPageNum

func (image *PxiImg) GetPageNum() []byte

func (*PxiImg) GetPxiId

func (image *PxiImg) GetPxiId() []byte

func (*PxiImg) GetRefNum

func (image *PxiImg) GetRefNum() []byte

func (*PxiImg) SetPxiId

func (image *PxiImg) SetPxiId(p []byte)

type PxiMeta

type PxiMeta struct {
	PxiId    string
	PageNum  string
	RefNum   string
	DataType string
	Bucket   string
	NumPages int
}

func New

func New() PxiMeta

func (*PxiMeta) GetBucket

func (pxi *PxiMeta) GetBucket() string

func (*PxiMeta) GetNumPages

func (pxi *PxiMeta) GetNumPages() int

func (*PxiMeta) GetPxiId

func (pxi *PxiMeta) GetPxiId() string

func (*PxiMeta) GetRefNum

func (pxi *PxiMeta) GetRefNum() string

type Request

type Request struct {
	InputFile string
	WriteTo   string
	OutputDir string /* Directory an S3 bucket  */
}

type Response

type Response struct {
	Bucket string
	Key    string
	Data   bytes.Buffer
	Number int
	Error  S3Error
}

type S3Error

type S3Error struct {
	Key string
	Err error
}

func GetPages

func GetPages(Req ToS3GetPages) (int, int, []S3Error)

func ToS3V1

func ToS3V1(req *ToS3Request) (int, int, int, int, []S3Error)
	Process 1 document at a time
    every page of the document is upload serially

func ToS3V1Async

func ToS3V1Async(req *ToS3Request) (int, int, int, int, []S3Error)

func ToS3V1Parallel

func ToS3V1Parallel(req *ToS3Request) (int, int, int, int, []S3Error)

Process one document at a time N pages of the document will be uploaded concurrently

type St33Reader

type St33Reader struct {
	*utils.VBRecord
}

func NewSt33Reader

func NewSt33Reader(infile string) (*St33Reader, error)

func (*St33Reader) ReadST33BLOB

func (r *St33Reader) ReadST33BLOB(v Conval)

func (*St33Reader) ReadST33Blob

func (r *St33Reader) ReadST33Blob(rdw int) ([]byte, error)

special Read

func (*St33Reader) ReadST33Tiff

func (r *St33Reader) ReadST33Tiff(v Conval, ind int) (int, int, bool)

type St33ToS3

type St33ToS3 struct {
	Request  ToS3Request  `json:"request"`
	Response ToS3Response `json:"response"`
}

type Tiff

type Tiff struct {
	Enc          binary.ByteOrder
	SFrH         []byte
	SFrW         []byte
	NlFrH        []byte
	NlFrW        []byte
	RotationCode []byte
	TotalLength  int
}

type ToS3GetPages

type ToS3GetPages struct {
	KEY  string
	Req  *ToS3Request
	CP   int
	Step int
	R    *St33Reader
	V    Conval
	Svc  *s3.S3
}

type ToS3Request

type ToS3Request struct {
	File           string `json:"input-file"`
	Bucket         string `json:"target-bucket"`
	Number         int    `json:"number-of-bucket"`
	LogBucket      string `json:"logging-bucket"`
	DatafilePrefix string `json:"data-file-prefix"`
	CrlfilePrefix  string `json:"control-file-prefix"`
	Profiling      int    `json:"run-with-profiling"`
	Reload         bool   `json:"reload"`
	Async          int    `json:"run-with-concurrent-number"`
	Check          bool   `json:"check"`
}

type ToS3Response

type ToS3Response struct {
	Time     time.Time `json:"ended-time"`
	Status   string    `json:"uploaded-status"`           // upload status
	Duration string    `json:"time-to-uploaded"`          // duration of the process
	Docs     int       `json:"number-of-documents"`       // number of documenst
	Pages    int       `json:"number-of-pages"`           // number of pages
	Size     int       `json:"total-uploaded-size"`       // total uploaded size
	Erroru   int       `json:"number-of-uploaded-errors"` // number of uploaded errors
	Errori   int       `json:"number-of-other-errors"`    // number of uploaded errors

}

type UserMd

type UserMd struct {
	Pximeta PxiMeta
	Pages   int
}

Jump to

Keyboard shortcuts

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