sys

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Copyright (c) 2023, donnie <donnie4w@gmail.com> All rights reserved. Use of t source code is governed by a BSD-style license that can be found in the LICENSE file.

github.com/donnie4w/wfs

Copyright (c) 2023, donnie <donnie4w@gmail.com> All rights reserved. Use of t source code is governed by a BSD-style license that can be found in the LICENSE file.

github.com/donnie4w/wfs

Copyright (c) 2023, donnie <donnie4w@gmail.com> All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

github.com/donnie4w/wfs

Index

Constants

View Source
const (
	KB = 1 << 10
	MB = 1 << 20
	GB = 1 << 30
)
View Source
const VERSION = "1.0.7"

Variables

View Source
var (
	Serve          = hashmap.NewTreeMap[int, Server](5)
	Wfs            Server
	STARTTIME      = time.Now()
	UUID           int64
	Service        string
	LOGDEBUG       bool
	GOGC           int
	Pid            string
	ORIGIN         string
	DEBUGADDR      string
	WFSJSON        string
	Conf           *ConfBean
	Mode           = 1
	MaxSigma       = float64(20)
	MaxSide        = 10000
	MaxPixel       = 300000000
	CompressType   = int32(1)
	WFSDATA        = "wfsdata"
	IMAGEVIEW2     = "?imageView2"
	IMAGEVIEW      = "?imageView"
	IMAGEMODE      = "?mode"
	MD2HTML        = "?md2html"
	DefaultAccount = [2]string{"admin", "123"}
	WEBADDR        = fmt.Sprint(6<<10 + 2)
	OPADDR         = fmt.Sprint(":", 5<<10+2)
	LISTEN         = 4<<10 + 2
	SYNC           = false
	Restrict       = 95
	DBBUFFER       = 1 << 6 * MB
	InaccurateTime = time.Now().UnixNano()
	ConnectTimeout = 10 * time.Second
	WaitTimeout    = 10 * time.Second
	FileSize       = int64(1000 * MB)
	DataMaxsize    = FileSize / 5
	SocketTimeout  = 10 * time.Second
	OpenSSL        = &openssl{}
	Memlimit       = int64(1 << 10)
	FileHash       = 0
)
View Source
var (
	KeyStoreInit func(string)
	Count        func() int64
	Seq          func() int64
	AppendData   func(string, []byte, int32) (int64, ERROR)
	GetData      func(string) []byte
	DelData      func(string) ERROR
	//Add            func([]byte, []byte) error
	//Del            func([]byte) error
	SearchLike     func(string) []*PathBean
	SearchLimit    func(int64, int64) []*PathBean
	Defrag         func(string) ERROR
	FragAnalysis   func(string) (*FragBean, ERROR)
	Export         func(func(*stub.SnapshotBean) bool) error
	ExportByINCR   func(int64, int64, func(*stub.SnapshotBeans) bool) ERROR
	ExportFile     func(int64, int64, func(*stub.SnapshotFile) bool) ERROR
	ExportByPaths  func([]string, func(snaps *stub.SnapshotBeans) bool) ERROR
	Import         func(*stub.SnapshotBean, bool) error
	ImportFile     func(*stub.SnapshotFile) ERROR
	Modify         func(string, string) ERROR
	WsClient       func(tls bool, pid, opaddr, requri, name, pwd string) (ws *WS, err error)
	IsEmptyBigFile func(string) bool
)
View Source
var ERR_AUTH = err(4105, "limited authority")
View Source
var ERR_DEFRAG_FORBID = err(5102, "operation files cannot be defragmented")
View Source
var ERR_DEFRAG_UNDERWAY = err(5103, "defragmentation is underway")
View Source
var ERR_EXSIT = err(4104, "has exist")
View Source
var ERR_FILEAPPEND = err(5105, "append data error")
View Source
var ERR_FILECREATE = err(5106, "create file error")
View Source
var ERR_NEWPATHEXIST = err(4107, "the new path already exists")
View Source
var ERR_NOPASS = err(4102, "verification fail")
View Source
var ERR_NOTEXSIT = err(4106, "not exist")
View Source
var ERR_OVERSIZE = err(4101, "data oversize")
View Source
var ERR_PARAMS = err(4103, "parameter error")
View Source
var ERR_STOPSERVICE = err(5104, "service has stopped")
View Source
var ERR_UNDEFINED = err(5101, "undefined error")

Functions

func FmtLog

func FmtLog(v ...any)

Types

type ConfBean

type ConfBean struct {
	FileSize           int64   `json:"filesize"`
	Opaddr             *string `json:"opaddr"`
	WebAddr            *string `json:"webaddr"`
	Listen             int     `json:"listen"`
	Admin_Ssl_crt      string  `json:"admin.ssl_certificate"`
	Admin_Ssl_crt_key  string  `json:"admin.ssl_certificate_key"`
	Ssl_crt            string  `json:"ssl_certificate"`
	Ssl_crt_key        string  `json:"ssl_certificate_key"`
	Memlimit           int64   `json:"memlimit"`
	DataMaxsize        int64   `json:"data.maxsize"`
	Init               bool    `json:"init"`
	Keystore           *string `json:"keystore"`
	Mode               *int    `json:"mode"`
	Sync               *bool   `json:"sync"`
	Compress           *int32  `json:"compress"`
	WfsData            *string `json:"data.dir"`
	SLASH              bool    `json:"prefix.slash"`
	MaxSigma           float64 `json:"maxsigma"`
	MaxSide            int     `json:"maxside"`
	MaxPixel           int     `json:"maxpixel"`
	Resample           int8    `json:"resample"`
	ImgViewingRevProxy string  `json:"imgViewingRevProxy"`
	FileHash           *int    `json:"filehash"`
	AdminUserName      *string `json:"adminusername"`
	AdminPassword      *string `json:"adminpassword"`
	Restrict           *int    `json:"restrict"`
}

func GetConfg

func GetConfg() (conf *ConfBean)

type ERROR

type ERROR interface {
	WfsError() *WfsError
	Error() error
	Equal(ERROR) bool
	Code() int32
}

type FragBean

type FragBean struct {
	Node       string
	RmSize     int64
	ActualSize int64
	FileSize   int64
}

type PathBean

type PathBean struct {
	Id         int64
	Path       string
	Body       []byte
	Timestramp int64
}

type Server

type Server interface {
	Serve() (err error)
	Close() (err error)
}

type WS

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

func NewWfsClient

func NewWfsClient(server, origin, name, password string) (_r *WS, err error)

func (*WS) Close

func (t *WS) Close() error

func (*WS) Receive

func (t *WS) Receive(procData func([]byte) bool) (err error)

func (*WS) Send

func (t *WS) Send(bs []byte) (err error)

Jump to

Keyboard shortcuts

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