Documentation ¶
Index ¶
Constants ¶
View Source
const ( // TokenSize max size of token array // clusterID + vid + bid + count + time + size TokenSize = 4 + 4 + 10 + 5 + 5 + 5 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type UploadToken ¶
UploadToken token between alloc and putat [0:8] hmac (8) first 8 bytes of sha1 summary [8:16] minBid (8) in the SliceInfo [16:20] count (4) in the SliceInfo [20:24] time (4) expired unix utc time, 0 means not expired
func NewUploadToken ¶
func NewUploadToken(clusterID proto.ClusterID, vid proto.Vid, bid proto.BlobID, count, size uint32, expiration time.Duration, secretKey []byte) UploadToken
NewUploadToken returns a token corresponding one SliceInfo in Location with expiration expiration = 0 means not expired forever
func (*UploadToken) IsValid ¶
func (t *UploadToken) IsValid(clusterID proto.ClusterID, vid proto.Vid, bid proto.BlobID, size uint32, secretKey []byte) bool
IsValid returns the token is valid or not
func (*UploadToken) IsValidBid ¶
func (t *UploadToken) IsValidBid(bid proto.BlobID) bool
IsValidBid returns the bid is valid or not
Click to show internal directories.
Click to hide internal directories.