state

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package state includes torrent state struct

Index

Constants

View Source
const FileExtension = ".state.json"

Variables

View Source
var File_pkg_state_state_proto protoreflect.FileDescriptor

Functions

func Write added in v0.2.0

func Write(writer io.Writer, state *State) error

Write writes state torrent to a writer

Types

type State

type State struct {
	FileHash        string  `protobuf:"bytes,1,opt,name=file_hash,json=fileHash,proto3" json:"file_hash,omitempty"`
	FileName        string  `protobuf:"bytes,2,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
	FileSize        int64   `protobuf:"varint,3,opt,name=file_size,json=fileSize,proto3" json:"file_size,omitempty"`
	PeersCount      int64   `protobuf:"varint,4,opt,name=peers_count,json=peersCount,proto3" json:"peers_count,omitempty"`
	DownloadedBytes int64   `protobuf:"varint,5,opt,name=downloaded_bytes,json=downloadedBytes,proto3" json:"downloaded_bytes,omitempty"`
	UploadedBytes   int64   `protobuf:"varint,6,opt,name=uploaded_bytes,json=uploadedBytes,proto3" json:"uploaded_bytes,omitempty"`
	ProgressPerc    float32 `protobuf:"fixed32,7,opt,name=progress_perc,json=progressPerc,proto3" json:"progress_perc,omitempty"`
	Ratio           float32 `protobuf:"fixed32,8,opt,name=ratio,proto3" json:"ratio,omitempty"`
	Completed       bool    `protobuf:"varint,9,opt,name=completed,proto3" json:"completed,omitempty"`
	Paused          bool    `protobuf:"varint,10,opt,name=paused,proto3" json:"paused,omitempty"`
	// contains filtered or unexported fields
}

func Read added in v0.2.0

func Read(reader io.Reader) (*State, error)

Read reads state from a reader

func (*State) Descriptor deprecated

func (*State) Descriptor() ([]byte, []int)

Deprecated: Use State.ProtoReflect.Descriptor instead.

func (*State) GetCompleted

func (x *State) GetCompleted() bool

func (*State) GetDownloadedBytes

func (x *State) GetDownloadedBytes() int64

func (*State) GetFileHash

func (x *State) GetFileHash() string

func (*State) GetFileName

func (x *State) GetFileName() string

func (*State) GetFileSize added in v0.3.0

func (x *State) GetFileSize() int64

func (*State) GetPaused

func (x *State) GetPaused() bool

func (*State) GetPeersCount

func (x *State) GetPeersCount() int64

func (*State) GetProgressPerc added in v0.4.0

func (x *State) GetProgressPerc() float32

func (*State) GetRatio added in v0.2.0

func (x *State) GetRatio() float32

func (*State) GetUploadedBytes

func (x *State) GetUploadedBytes() int64

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) ProtoReflect

func (x *State) ProtoReflect() protoreflect.Message

func (*State) Reset

func (x *State) Reset()

func (*State) String

func (x *State) String() string

Jump to

Keyboard shortcuts

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