store

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLeveldbStore

func NewLeveldbStore(path string) (interface{}, error)

func NewMemoryStore

func NewMemoryStore() (interface{}, error)

Types

type DownloadStore

type DownloadStore interface {
	GetOffset(figerprint string) (int64, bool) // 获取当前最小的offset
	SetOffset(figerprint string, offset int64) error
	Delete(fingerprint string) error
	Close() error

	SetMaxOffset(figerprint string, offset int64) error // 设置一个figerprint最大的切片数
	GetMaxOffset(figerprint string) (int64, bool)
	GetBlankOffset(figerprint string) (int64, bool)    // 并发安全 获取一个还未下载的切片
	SetOkOffset(figerprint string, offset int64) error // 并发安全 标记一个切片已经下载完成
	SetFailOffset(figerprint string, offset int64) error
	IsDone(figerprint string) bool // 判断是否下载完成
	IsCombile(figerprint string) error
	SetCombile(figerprint string) error
}

需要支持多协程,因此chunk需要支持非连续机制

type LeveldbStore

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

func (*LeveldbStore) Close

func (s *LeveldbStore) Close() error

func (*LeveldbStore) Delete

func (s *LeveldbStore) Delete(fingerprint string) error

func (*LeveldbStore) Get

func (s *LeveldbStore) Get(fingerprint string) (string, bool)

func (*LeveldbStore) GetBlankOffset

func (s *LeveldbStore) GetBlankOffset(figerprint string) (int64, bool)

并发安全 获取一个还未下载的切片 leveldb val : 1,1,1,1,1,1,1

func (*LeveldbStore) GetMaxOffset

func (s *LeveldbStore) GetMaxOffset(figerprint string) (int64, bool)

func (*LeveldbStore) GetOffset

func (s *LeveldbStore) GetOffset(fingerprint string) (int64, bool)

func (*LeveldbStore) IsCombile

func (s *LeveldbStore) IsCombile(figerprint string) error

func (*LeveldbStore) IsDone

func (s *LeveldbStore) IsDone(figerprint string) bool

func (*LeveldbStore) Set

func (s *LeveldbStore) Set(fingerprint, url string) error

func (*LeveldbStore) SetCombile

func (s *LeveldbStore) SetCombile(figerprint string) error

func (*LeveldbStore) SetFailOffset

func (s *LeveldbStore) SetFailOffset(figerprint string, offset int64) error

func (*LeveldbStore) SetMaxOffset

func (s *LeveldbStore) SetMaxOffset(figerprint string, offset int64) error

设置一个figerprint最大的切片数

func (*LeveldbStore) SetOffset

func (s *LeveldbStore) SetOffset(fingerprint string, offset int64) error

func (*LeveldbStore) SetOkOffset

func (s *LeveldbStore) SetOkOffset(figerprint string, offset int64) error

并发安全 标记一个切片已经下载完成

type MemoryStore

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

func (*MemoryStore) Close

func (s *MemoryStore) Close() error

func (*MemoryStore) Delete

func (s *MemoryStore) Delete(fingerprint string) error

func (*MemoryStore) Get

func (s *MemoryStore) Get(fingerprint string) (string, bool)

func (*MemoryStore) GetBlankOffset

func (s *MemoryStore) GetBlankOffset(figerprint string) (int64, bool)

并发安全 获取一个还未下载的切片

func (*MemoryStore) GetMaxOffset

func (s *MemoryStore) GetMaxOffset(figerprint string) (int64, bool)

func (*MemoryStore) GetOffset

func (s *MemoryStore) GetOffset(fingerprint string) (int64, bool)

func (*MemoryStore) IsCombile

func (s *MemoryStore) IsCombile(figerprint string) error

func (*MemoryStore) IsDone

func (s *MemoryStore) IsDone(figerprint string) bool

func (*MemoryStore) Set

func (s *MemoryStore) Set(fingerprint, url string) error

func (*MemoryStore) SetCombile

func (s *MemoryStore) SetCombile(figerprint string) error

func (*MemoryStore) SetFailOffset

func (s *MemoryStore) SetFailOffset(figerprint string, offset int64) error

并发安全 标记一个切片已经下载失败

func (*MemoryStore) SetMaxOffset

func (s *MemoryStore) SetMaxOffset(figerprint string, offset int64) error

设置一个figerprint最大的切片数

func (*MemoryStore) SetOffset

func (s *MemoryStore) SetOffset(fingerprint string, offset int64) error

func (*MemoryStore) SetOkOffset

func (s *MemoryStore) SetOkOffset(figerprint string, offset int64) error

并发安全 标记一个切片已经下载完成

type UploadStore

type UploadStore interface {
	Get(fingerprint string) (string, bool)
	Set(fingerprint, url string) error
	Delete(fingerprint string) error
	Close() error
}

Jump to

Keyboard shortcuts

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