Documentation ¶
Index ¶
- Constants
- func AddInterval(end, gzSize uint64) error
- func LoadConfig(config interface{}) error
- func LoadConfigByPath(path string, config interface{}) error
- func Run() error
- type Config
- type Login
- type OssConfig
- type UploadKeeper
- func (u *UploadKeeper) AddInterval(end, gzSize uint64) error
- func (u *UploadKeeper) GetBlockArray(start, length uint64) ([]*types.Block, error)
- func (u *UploadKeeper) GetInfoJson() (*util.Info, error)
- func (u *UploadKeeper) PutInfoJson(infoData *util.Info) error
- func (u *UploadKeeper) PutObjByteArr(objectName string, objectValue []byte) error
- func (u *UploadKeeper) Run()
- func (u *UploadKeeper) SetLatestBlockHeight(newLatestBlockHeight uint64) error
- func (u *UploadKeeper) Upload() error
- func (u *UploadKeeper) UploadFiles(start, end, size uint64) error
Constants ¶
const LOCALDIR = "./blocks/" // Local directory to store temp blocks files
Variables ¶
This section is empty.
Functions ¶
func AddInterval ¶
AddInterval if "info.json" exists on OSS, add Interval to the end; if not exist, create "info.json" with Interval
func LoadConfig ¶
func LoadConfig(config interface{}) error
LoadConfig read path file to the config object for Upload from Vapor to OSS
func LoadConfigByPath ¶
LoadConfigByPath read path file to the config object
Types ¶
type Login ¶
type Login struct { Endpoint string `json:"endpoint"` AccessKeyID string `json:"access_key_id"` AccessKeySecret string `json:"access_key_secret"` }
Oss logs cfg
type OssConfig ¶
type OssConfig struct { Login *Login `json:"login"` Bucket string `json:"bucket"` Directory string `json:"directory"` }
Oss cfg
type UploadKeeper ¶
type UploadKeeper struct { Node *apinode.Node OssClient *oss.Client OssBucket *oss.Bucket OssDir string FileUtil *util.FileUtil }
UploadKeeper the struct for upload
func NewUploadKeeper ¶
func NewUploadKeeper() (*UploadKeeper, error)
NewUploadKeeper return one new instance of UploadKeeper
func (*UploadKeeper) AddInterval ¶
func (u *UploadKeeper) AddInterval(end, gzSize uint64) error
AddInterval if "info.json" exists on OSS, add Interval to the end; if not exist, create "info.json" with Interval
func (*UploadKeeper) GetBlockArray ¶
func (u *UploadKeeper) GetBlockArray(start, length uint64) ([]*types.Block, error)
GetBlockArray return the RawBlockArray by BlockHeight from start to start+length-1
func (*UploadKeeper) GetInfoJson ¶
func (u *UploadKeeper) GetInfoJson() (*util.Info, error)
GetInfoJson Download info.json
func (*UploadKeeper) PutInfoJson ¶
func (u *UploadKeeper) PutInfoJson(infoData *util.Info) error
Upload info.json
func (*UploadKeeper) PutObjByteArr ¶
func (u *UploadKeeper) PutObjByteArr(objectName string, objectValue []byte) error
PutObjByteArr upload Byte Array object
func (*UploadKeeper) Run ¶
func (u *UploadKeeper) Run()
Run synchronize upload blocks from vapor to OSS
func (*UploadKeeper) SetLatestBlockHeight ¶
func (u *UploadKeeper) SetLatestBlockHeight(newLatestBlockHeight uint64) error
SetLatestBlockHeight set new latest blockHeight on OSS
func (*UploadKeeper) UploadFiles ¶
func (u *UploadKeeper) UploadFiles(start, end, size uint64) error
UploadFiles get block from vapor and upload files to OSS