opts

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbFile  = "database.db"
	Version = "0.0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

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

Options 是用于创建文件存储对象的参数

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions 设置一个推荐选项列表以获得良好的性能。

func (*Options) BuildDefaultFileKey

func (opt *Options) BuildDefaultFileKey(pubKey string)

BuildDefaultFileKey 设置默认文件密钥

func (*Options) BuildDefaultOwnerPriv

func (opt *Options) BuildDefaultOwnerPriv(ownerPriv *ecdsa.PrivateKey)

BuildDefaultOwnerPriv 设置默认所有者的私钥

func (*Options) BuildDownloadPath

func (opt *Options) BuildDownloadPath(path string)

BuildDownloadPath 设置下载路径

func (*Options) BuildLocalStorage

func (opt *Options) BuildLocalStorage(isEnable bool)

BuildLocalStorage 设置是否启动本地存储选项

func (*Options) BuildMaxSliceSize

func (opt *Options) BuildMaxSliceSize(maxSliceSize int64) error

BuildMaxSliceSize 设置最大切片的大小选项

func (*Options) BuildMinSliceSize

func (opt *Options) BuildMinSliceSize(minSliceSize int64) error

BuildMinSliceSize 设置最小切片的大小

func (*Options) BuildRootPath

func (opt *Options) BuildRootPath(path string)

BuildRootPath 设置文件根路径

func (*Options) BuildRoutingTableLow

func (opt *Options) BuildRoutingTableLow(low int64)

BuildRoutingTableLow 设置路由表中连接的最小节点数量

func (*Options) BuildShardsOptions

func (opt *Options) BuildShardsOptions(dataShards, parityShards int64) error

BuildShardsOptions 设置奇偶分片大小选项

func (*Options) BuildSizeAndRatioOptions

func (opt *Options) BuildSizeAndRatioOptions(shardSize int64, parityRatio float64) error

BuildSizeAndRatioOptions 设置奇偶分片比例选项 shardSize 以字节为单位

func (*Options) BuildStorageMode

func (opt *Options) BuildStorageMode(storageMode StorageMode)

BuildStorageMode 设置存储模式

func (*Options) GetDataShards

func (opt *Options) GetDataShards() int64

GetDataShards 获取文件数据片段的数量

func (*Options) GetDefaultBufSize

func (opt *Options) GetDefaultBufSize() int64

GetDefaultBufSize 获取常用缓冲区的大小

func (*Options) GetDefaultFileKey

func (opt *Options) GetDefaultFileKey() string

GetDefaultFileKey 获取默认文件密钥

func (*Options) GetDefaultOwnerPriv

func (opt *Options) GetDefaultOwnerPriv() *ecdsa.PrivateKey

GetDefaultOwnerPriv 获取默认所有者的私钥

func (*Options) GetDownloadPath

func (opt *Options) GetDownloadPath() string

GetDownloadPath 获取下载路径

func (*Options) GetLocalStorage

func (opt *Options) GetLocalStorage() bool

GetLocalStorage 获取是否开启本地存储,上传成功后保留本地文件片段

func (*Options) GetMaxBufferSize

func (opt *Options) GetMaxBufferSize() int64

GetMaxBufferSize 获取最大缓冲区的大小

func (*Options) GetMaxRetries

func (opt *Options) GetMaxRetries() int64

GetMaxRetries 获取最大重试次数

func (*Options) GetMaxSliceSize

func (opt *Options) GetMaxSliceSize() int64

GetMaxSliceSize 获取最大片段的大小

func (*Options) GetMaxXrefTable

func (opt *Options) GetMaxXrefTable() int64

GetMaxXrefTable 获取Xref表中段的最大数量

func (*Options) GetMinSliceSize

func (opt *Options) GetMinSliceSize() int64

GetMinSliceSize 获取最小片段的大小

func (*Options) GetParityRatio

func (opt *Options) GetParityRatio() float64

GetParityRatio 获取奇偶校验片段占比

func (*Options) GetParityShards

func (opt *Options) GetParityShards() int64

GetParityShards 获取奇偶校验片段的数量

func (*Options) GetRetryInterval

func (opt *Options) GetRetryInterval() time.Duration

GetRetryInterval 获取重试间隔

func (*Options) GetRootPath

func (opt *Options) GetRootPath() string

GetRootPath 获取文件根路径

func (*Options) GetRoutingTableLow

func (opt *Options) GetRoutingTableLow() int64

GetRoutingTableLow 获取路由表中连接的最小节点数量

func (*Options) GetShardSize

func (opt *Options) GetShardSize() int64

GetShardSize 获取文件片段的大小

func (*Options) GetShardsOptions

func (opt *Options) GetShardsOptions() (int64, int64, bool)

GetShardsOptions 获取奇偶分片大小选项

func (*Options) GetSizeAndRatioOptions

func (opt *Options) GetSizeAndRatioOptions() (int64, float64, bool)

GetSizeAndRatioOptions 获取奇偶分片比例选项

func (*Options) GetStorageMode

func (opt *Options) GetStorageMode() StorageMode

GetStorageMode 获取存储模式

type StorageMode

type StorageMode int

存储模式

const (
	FileMode      StorageMode = iota // 文件模式
	SliceMode                        // 切片模式,将文件分割成有限个切片(不使用纠删码)
	RS_Size                          // 纠删码(大小)模式
	RS_Proportion                    // 纠删码(比例)模式
)

Jump to

Keyboard shortcuts

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