synapse

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: GPL-3.0, GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MinMemoryUsage int64 = 2 * 1024 * 1024 * 1024
View Source
const PLUGIN_PATH string = "plugins/"
View Source
const PLUGIN_POST_FIX string = "_cvm.so"
View Source
const ReservedMemoryUsage int64 = 512 * 1024 * 1024

Variables

View Source
var (
	ErrBuiltInTorrentFsPrefix = "BUILT-IN TORRENT FS ERROR"

	ErrInputFileNotExistFlag = "[ " + ErrBuiltInTorrentFsPrefix + " ] input file not exist"
	ErrModelFileNotExistFlag = "[ " + ErrBuiltInTorrentFsPrefix + " ] model file not exist"

	ErrInputFileNotExist = errors.New(ErrInputFileNotExistFlag)
	ErrModelFileNotExist = errors.New(ErrModelFileNotExistFlag)

	ErrFatal = errors.New("fatal")
)

Functions

func CheckBuiltInTorrentFsError added in v1.0.0

func CheckBuiltInTorrentFsError(err error) bool

If infered by local, check struct error is enough. Else infered by remote, must be checked by error's text

func RLPHashString added in v1.0.0

func RLPHashString(x interface{}) string

func ReadData added in v1.0.0

func ReadData(inputFilePath string) ([]byte, error)

func SwitchEndian added in v1.0.0

func SwitchEndian(data []byte, bytes int) ([]byte, error)

func ToAlignedData added in v1.0.0

func ToAlignedData(data []byte, bytes int) ([]byte, error)

Types

type Config

type Config struct {
	// StorageDir    string `toml:",omitempty"`
	IsNotCache     bool   `toml:",omitempty"`
	DeviceType     string `toml:",omitempty"`
	DeviceId       int    `toml:",omitempty"`
	IsRemoteInfer  bool   `toml:",omitempty"`
	InferURI       string `toml:",omitempty"`
	Debug          bool   `toml:",omitempty"`
	MaxMemoryUsage int64
	Storagefs      torrentfs.CVMStorage
}
var DefaultConfig Config = Config{

	IsNotCache:     false,
	DeviceType:     "cpu",
	DeviceId:       0,
	IsRemoteInfer:  false,
	InferURI:       "",
	Debug:          false,
	MaxMemoryUsage: 4 * 1024 * 1024 * 1024,
}

type Synapse

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

func Engine

func Engine() *Synapse

func New

func New(config *Config) *Synapse

func (*Synapse) Close

func (s *Synapse) Close()

func (*Synapse) GetGasByInfoHash added in v1.0.0

func (s *Synapse) GetGasByInfoHash(modelInfoHash string) (gas uint64, err error)

func (*Synapse) InferByInfoHash

func (s *Synapse) InferByInfoHash(modelInfoHash, inputInfoHash string) ([]byte, error)

func (*Synapse) InferByInputContent

func (s *Synapse) InferByInputContent(modelInfoHash string, inputContent []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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