Documentation
¶
Index ¶
- Constants
- func DecryptSegment(fpath, cipher string) error
- func OtherHeader(c *gin.Context, fname string)
- func Subscribe(ctx context.Context, h host.Host, bootnode string, ...)
- func VerifyEthSign(message string, sign string) (string, error)
- func VideoAndAudioHeader(c *gin.Context, fname string)
- type CansRequestParams
- type ChunksInfo
- type DuplicateType
- type Location
- type Metadata
- type Node
- func (n *Node) AccessControl(account string) error
- func (n *Node) CheckLocalFile(fid string) (int64, string, error)
- func (n *Node) DeleteStoragePeer(peerid string)
- func (n *Node) DeleteTrackFile(filehash string)
- func (n *Node) Delete_bucket(c *gin.Context)
- func (n *Node) Delete_file(c *gin.Context)
- func (n *Node) Download_file(c *gin.Context)
- func (n *Node) FeedbackLog(c *gin.Context)
- func (n *Node) GetAllStoragePeerId() []string
- func (n *Node) GetCanFileHandle(c *gin.Context)
- func (n *Node) GetRestoreHandle(c *gin.Context)
- func (n *Node) GetSegment(fdir, fhash, cipher string, sid int) (fpath string, err error)
- func (n *Node) Get_bucket(c *gin.Context)
- func (n *Node) Get_location(c *gin.Context)
- func (n *Node) Get_metadata(c *gin.Context)
- func (n *Node) Get_version(c *gin.Context)
- func (n *Node) HasStoragePeer(peerid string) bool
- func (n *Node) HasTrackFile(filehash string) bool
- func (n *Node) InitFileCache(exp time.Duration, maxSpace int64, cacheDir string)
- func (n *Node) InitNodeSelector(strategy string, nodeFilePath string, maxNodeNum int, ...) error
- func (n *Node) ListTrackFiles() ([]string, error)
- func (n *Node) NotFound(c *gin.Context)
- func (n *Node) ParseTrackFile(filehash string) (RecordInfo, error)
- func (n *Node) Preview_file(c *gin.Context)
- func (n *Node) PutChunksHandle(c *gin.Context)
- func (n *Node) Put_bucket(c *gin.Context)
- func (n *Node) Put_file(c *gin.Context)
- func (n *Node) Put_object(c *gin.Context)
- func (n *Node) QueryFileType(fid string, account string) (string, string, int, error)
- func (n *Node) RebuildDirs()
- func (n *Node) RefreshMiner(ch chan<- bool)
- func (n *Node) RefreshSelf() error
- func (n *Node) RestoreFile(c *gin.Context)
- func (n *Node) ReturnFile(c *gin.Context, reader io.Reader, fid, contenttype, format string, size int64)
- func (n *Node) Run()
- func (n *Node) SaveStoragePeer(peerid string)
- func (n *Node) SetFadebackDir(dir string)
- func (n *Node) SetSignkey(signkey []byte)
- func (n *Node) SetTrackDir(dir string)
- func (n *Node) TaskMgt()
- func (n *Node) Tracker(ch chan<- bool)
- func (n *Node) VerifyAccountSignature(account, msg, signature string) ([]byte, error)
- func (n *Node) WriteTrackFile(fid string, data []byte) error
- type NodeInfo
- type PeerRecord
- type PeerRecordType
- func (p *PeerRecordType) BackupPeer(path string) error
- func (p *PeerRecordType) GetAllPeerId() []string
- func (p *PeerRecordType) GetPeer(peerid string) (peer.AddrInfo, bool)
- func (p *PeerRecordType) GetPeerByAccount(account string) (peer.AddrInfo, bool)
- func (p *PeerRecordType) HasPeer(peerid string) bool
- func (p *PeerRecordType) LoadPeer(path string) error
- func (p *PeerRecordType) SavePeer(addr peer.AddrInfo) error
- func (p PeerRecordType) SavePeerAccount(account string, peerid string) error
- type RecordInfo
- type RestoreList
- type RtnUserBrief
Constants ¶
View Source
const ( CANS_PROTO_FLAG = "CANS_PROTO_" CHUNK_FILE_FLAG = "--CESS-chunk-file--" CANS_PROTO_HEADER = "CanProtocol" CANS_SPLIT_FILE_HEADER = "FileSplit" CANS_ARCHIVE_FORMAT_HEADER = "ArchiveFormat" FILE_METADATA_KEY = "_file_metadata_" )
View Source
const ( HTTPHeader_Authorization = "Authorization" HTTPHeader_Bucket = "Bucket" HTTPHeader_Territory = "Territory" HTTPHeader_Account = "Account" HTTPHeader_EthAccount = "EthAcc" HTTPHeader_Digest = "Digest" HTTPHeader_Operation = "Operation" HTTPHeader_Message = "Message" HTTPHeader_Signature = "Signature" HTTPHeader_Fid = "Fid" HTTPHeader_Cipher = "Cipher" HTTPHeader_BIdx = "BlockIndex" HTTPHeader_BNum = "BlockNumber" HTTPHeader_Fname = "FileName" HTTPHeader_TSize = "TotalSize" HTTPHeader_Format = "Format" )
HTTP HEADER
View Source
const ( Active = iota Calculate Missing Recovery )
View Source
const ( HTTP_ParameterName = "name" HTTP_ParameterName_Fid = "fid" HTTP_Parameter_BucketNme = "bucket_name" FormFileKey1 = "file" FormFileKey2 = "File" FormFileKey3 = "FILE" )
View Source
const ( INFO_PutRequest = "PutRequest" INFO_PostRestoreRequest = "PostRestoreRequest" INFO_GetRequest = "GetRequest" INFO_GetRestoreRequest = "GetRestoreRequest" INFO_DelRequest = "DelRequest" ERR_DuplicateOrder = "duplicate order" ERR_MissToken = "InvalidHead.MissToken" ERR_EmptySeed = "InvalidProfile.EmptySeed" ERR_MissingAccount = "InvalidHead.MissingAccount" ERR_InvalidAccount = "InvalidHead.Account" ERR_NoPermission = "InvalidToken.NoPermission" ERR_InvalidToken = "InvalidHead.Token" ERR_InvalidName = "InvalidParameter.Name" ERR_InvalidFilehash = "InvalidParameter.FileHash" ERR_InvalidParaBucketName = "InvalidParameter.BucketName" ERR_InvalidBucketName = "InvalidHead.BucketName" ERR_EmptyBucketName = "Invalid.EmptyBucketName" ERR_EmptyFile = "InvalidBody.EmptyFile" ERR_EmptyBody = "InvalidBody.EmptyBody" ERR_ReadBody = "InvalidBody.ReadErr" ERR_ParseBody = "InvalidBody.ParseErr" //ERR_SpaceExpired = "space expired" ERR_NotEnoughSpace = "not enough account space" ERR_InsufficientTerritorySpace = "insufficient territory space" ERR_InternalServer = "InternalError" ERR_FileNameTooLang = "The file name length cannot exceed 63 characters" ERR_FileNameTooShort = "The file name must be at least 3 characters long" ERR_NoSpace = "please purchase space first" ERR_NoTerritory = "please purchase territory first" )
View Source
const ( ERR_Authorization = "HeaderErr_Invalid_Authorization" ERR_HeadOperation = "HeaderErr_Invalid_Operation" ERR_NotFound = "Not found" ERR_Forbidden = "no permission" ERR_BodyFormat = "BodyErr_InvalidDataFormat" ERR_BodyFieldAccount = "BodyErr_InvalidField_account" ERR_BodyFieldMessage = "BodyErr_InvalidField_message" ERR_BodyFieldSignature = "BodyErr_InvalidField_signature" ERR_BodyEmptyFile = "BodyErr_EmptyFile" ERR_HeaderFieldBucketName = "HeaderErr_InvalidBucketName" ERR_AccountNotExist = "account does not exist" ERR_RpcFailed = "rpc connection failed" ERR_SpaceExpiresSoon = "space expires soon" ERR_TerritoryExpiresSoon = "territory expires soon" ERR_SpaceNotAuth = "space is not authorized" ERR_DeviceSpaceNoLeft = "no space left on the server device" ERR_SysMemNoLeft = "server unsupported file size" ERR_ReceiveFile = "InternalError" )
View Source
const ( Cache_SyncBlock = "syncblock" Cache_UserFiles = "userfiles:" Cache_UserDeleteFiles = "userdeletefiles:" Cache_WantFiles = "wantfiles:" )
View Source
const MaxMemUsed = 512 << 20
View Source
const MinRecordInfoLength = 132
MinRecordInfoLength = len(json.Marshal(RecordInfo{}))
View Source
const Notfound = `` /* 1534-byte string literal not displayed */
View Source
const TokenDated = 60 * 60 * 24 * 30
Variables ¶
This section is empty.
Functions ¶
func DecryptSegment ¶ added in v0.3.7
func OtherHeader ¶ added in v0.3.7
func VerifyEthSign ¶ added in v0.3.6
func VideoAndAudioHeader ¶ added in v0.3.7
Types ¶
type CansRequestParams ¶ added in v0.3.7
type ChunksInfo ¶ added in v0.3.7
type DuplicateType ¶ added in v0.3.7
type DuplicateType uint8
const ( // not duplicate Duplicate0 DuplicateType = 0 // not in file.owners Duplicate1 DuplicateType = 1 // in file.owners Duplicate2 DuplicateType = 2 )
type Metadata ¶ added in v0.3.7
type Metadata struct {
Fid string `json:"fid"`
Size uint64 `json:"size"`
Owner []RtnUserBrief `json:"owner"`
}
file meta info
type Node ¶
type Node struct {
inter.TrackFile
confile.Confile
logger.Logger
db.Cache
PeerRecord
cacher.FileCache
scheduler.Selector
*chain.ChainClient
*core.PeerNode
*gin.Engine
// contains filtered or unexported fields
}
func (*Node) AccessControl ¶ added in v0.3.3
func (*Node) CheckLocalFile ¶ added in v0.3.7
func (*Node) DeleteStoragePeer ¶ added in v0.3.3
func (*Node) DeleteTrackFile ¶
func (*Node) Delete_bucket ¶ added in v0.3.7
func (*Node) Delete_file ¶ added in v0.3.7
delHandle is used to delete buckets or files
func (*Node) Download_file ¶ added in v0.3.7
func (*Node) FeedbackLog ¶ added in v0.3.7
func (*Node) GetAllStoragePeerId ¶ added in v0.3.3
func (*Node) GetCanFileHandle ¶ added in v0.3.7
func (*Node) GetRestoreHandle ¶ added in v0.3.7
getHandle
func (*Node) GetSegment ¶ added in v0.3.7
func (*Node) Get_bucket ¶ added in v0.3.7
func (*Node) Get_location ¶ added in v0.3.7
func (*Node) Get_metadata ¶ added in v0.3.7
func (*Node) HasStoragePeer ¶ added in v0.3.3
func (*Node) HasTrackFile ¶
func (*Node) InitFileCache ¶ added in v0.3.7
func (*Node) InitNodeSelector ¶ added in v0.3.7
func (*Node) ListTrackFiles ¶
func (*Node) ParseTrackFile ¶ added in v0.3.3
func (n *Node) ParseTrackFile(filehash string) (RecordInfo, error)
func (*Node) Preview_file ¶ added in v0.3.7
func (*Node) PutChunksHandle ¶ added in v0.3.7
func (*Node) Put_bucket ¶ added in v0.3.7
func (*Node) Put_object ¶ added in v0.3.7
func (*Node) QueryFileType ¶ added in v0.3.7
func (*Node) RebuildDirs ¶
func (n *Node) RebuildDirs()
func (*Node) RefreshMiner ¶ added in v0.3.7
func (*Node) RefreshSelf ¶ added in v0.3.7
func (*Node) ReturnFile ¶ added in v0.3.7
func (*Node) SaveStoragePeer ¶ added in v0.3.3
func (*Node) SetFadebackDir ¶ added in v0.3.1
func (*Node) SetSignkey ¶
func (*Node) SetTrackDir ¶ added in v0.2.4
func (*Node) VerifyAccountSignature ¶ added in v0.3.6
type PeerRecord ¶ added in v0.3.7
type PeerRecord interface {
// SavePeer saves or updates peer information
SavePeer(addr peer.AddrInfo) error
//
SavePeerAccount(account string, peerid string) error
//
HasPeer(peerid string) bool
//
GetPeer(peerid string) (peer.AddrInfo, bool)
//
GetPeerByAccount(account string) (peer.AddrInfo, bool)
//
GetAllPeerId() []string
//
BackupPeer(path string) error
//
LoadPeer(path string) error
}
func NewPeerRecord ¶ added in v0.3.7
func NewPeerRecord() PeerRecord
type PeerRecordType ¶ added in v0.3.7
type PeerRecordType struct {
// contains filtered or unexported fields
}
func (*PeerRecordType) BackupPeer ¶ added in v0.3.7
func (p *PeerRecordType) BackupPeer(path string) error
func (*PeerRecordType) GetAllPeerId ¶ added in v0.3.7
func (p *PeerRecordType) GetAllPeerId() []string
func (*PeerRecordType) GetPeer ¶ added in v0.3.7
func (p *PeerRecordType) GetPeer(peerid string) (peer.AddrInfo, bool)
func (*PeerRecordType) GetPeerByAccount ¶ added in v0.3.7
func (p *PeerRecordType) GetPeerByAccount(account string) (peer.AddrInfo, bool)
func (*PeerRecordType) HasPeer ¶ added in v0.3.7
func (p *PeerRecordType) HasPeer(peerid string) bool
func (*PeerRecordType) LoadPeer ¶ added in v0.3.7
func (p *PeerRecordType) LoadPeer(path string) error
func (*PeerRecordType) SavePeer ¶ added in v0.3.7
func (p *PeerRecordType) SavePeer(addr peer.AddrInfo) error
func (PeerRecordType) SavePeerAccount ¶ added in v0.3.7
func (p PeerRecordType) SavePeerAccount(account string, peerid string) error
type RecordInfo ¶
type RecordInfo struct {
Segment []chain.SegmentDataInfo `json:"segment"`
Owner []byte `json:"owner"`
Fid string `json:"fid"`
FileName string `json:"file_name"`
BucketName string `json:"bucket_name"`
TerritoryName string `json:"territory_name"`
CacheDir string `json:"cache_dir"`
Cipher string `json:"cipher"`
FileSize uint64 `json:"file_size"`
PutFlag bool `json:"put_flag"`
}
type RestoreList ¶ added in v0.3.2
type RestoreList struct {
Files []string `json:"files"`
}
type RtnUserBrief ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.