Documentation
¶
Index ¶
- Constants
- Variables
- func VerifyID(encodedEncryptedData []byte, id ID) error
- type BServerError
- type BServerErrorBadRequest
- type BServerErrorBlockArchived
- type BServerErrorBlockDeleted
- type BServerErrorBlockNonExistent
- type BServerErrorMaxRefExceeded
- type BServerErrorNoPermission
- type BServerErrorNonceNonExistent
- type BServerErrorOverQuota
- type BServerErrorThrottle
- type BServerErrorUnauthorized
- type BServerErrorUnwrapper
- type Context
- type ContextMap
- type ID
- type RefNonce
- type UsageStat
- type UsageType
- type UserQuotaInfo
Constants ¶
const ( // StatusCodeBServerError is the error code for a generic block server error. StatusCodeBServerError = 2700 // StatusCodeBServerErrorBadRequest is the error code for a generic client error. StatusCodeBServerErrorBadRequest = 2701 StatusCodeBServerErrorUnauthorized = 2702 // StatusCodeBServerErrorOverQuota is the error code for when the user has exceeded his quota StatusCodeBServerErrorOverQuota = 2703 // StatusCodeBServerErrorBlockNonExistent is the error code for when bserver cannot find a block StatusCodeBServerErrorBlockNonExistent = 2704 // StatusCodeBServerErrorBlockArchived is the error code for a block has been archived StatusCodeBServerErrorBlockArchived = 2705 // StatusCodeBServerErrorNoPermission is the error code for when there's no permission StatusCodeBServerErrorNoPermission = 2706 // StatusCodeBServerErrorBlockDeleted is the error code for a block has been deleted StatusCodeBServerErrorBlockDeleted = 2707 // StatusCodeBServerErrorNonceNonExistent is the error code when a nonce cannot be found StatusCodeBServerErrorNonceNonExistent = 2708 // StatusCodeBServerErrorMaxRefExceeded is the error code to indicate there are too many refs to a block StatusCodeBServerErrorMaxRefExceeded = 2709 // StatusCodeBServerErrorThrottle is the error code to indicate the client should initiate backoff. StatusCodeBServerErrorThrottle = 2799 )
const MaxIDStringLength = kbfshash.MaxHashStringLength
MaxIDStringLength is the maximum length of the string representation of a ID.
Variables ¶
var ZeroRefNonce = RefNonce([8]byte{0, 0, 0, 0, 0, 0, 0, 0})
ZeroRefNonce is a special BlockRefNonce used for the initial reference to a block.
Functions ¶
Types ¶
type BServerError ¶
type BServerError struct {
Msg string
}
BServerError is a generic bserver-side error.
func (BServerError) Error ¶
func (e BServerError) Error() string
Error implements the Error interface for BServerError.
func (BServerError) ToStatus ¶
func (e BServerError) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerError.
type BServerErrorBadRequest ¶
type BServerErrorBadRequest struct {
Msg string
}
BServerErrorBadRequest is a generic client-side error.
func (BServerErrorBadRequest) Error ¶
func (e BServerErrorBadRequest) Error() string
Error implements the Error interface for BServerError.
func (BServerErrorBadRequest) ToStatus ¶
func (e BServerErrorBadRequest) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerError.
type BServerErrorBlockArchived ¶
type BServerErrorBlockArchived struct {
Msg string
}
BServerErrorBlockArchived is an exportable error from bserver
func (BServerErrorBlockArchived) Error ¶
func (e BServerErrorBlockArchived) Error() string
Error implements the Error interface for BServerErrorBlockArchived.
func (BServerErrorBlockArchived) ToStatus ¶
func (e BServerErrorBlockArchived) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorBlockArchived
type BServerErrorBlockDeleted ¶
type BServerErrorBlockDeleted struct {
Msg string
}
BServerErrorBlockDeleted is an exportable error from bserver
func (BServerErrorBlockDeleted) Error ¶
func (e BServerErrorBlockDeleted) Error() string
Error implements the Error interface for BServerErrorBlockDeleted
func (BServerErrorBlockDeleted) ToStatus ¶
func (e BServerErrorBlockDeleted) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorBlockDeleted
type BServerErrorBlockNonExistent ¶
type BServerErrorBlockNonExistent struct {
Msg string
}
BServerErrorBlockNonExistent is an exportable error from bserver
func (BServerErrorBlockNonExistent) Error ¶
func (e BServerErrorBlockNonExistent) Error() string
Error implements the Error interface for BServerErrorBlockNonExistent.
func (BServerErrorBlockNonExistent) ToStatus ¶
func (e BServerErrorBlockNonExistent) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorBlockNonExistent
type BServerErrorMaxRefExceeded ¶
type BServerErrorMaxRefExceeded struct {
Msg string
}
BServerErrorMaxRefExceeded is an exportable error from bserver
func (BServerErrorMaxRefExceeded) Error ¶
func (e BServerErrorMaxRefExceeded) Error() string
Error implements the Error interface for BServerErrorMaxRefExceeded
func (BServerErrorMaxRefExceeded) ToStatus ¶
func (e BServerErrorMaxRefExceeded) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorMaxRefExceeded
type BServerErrorNoPermission ¶
type BServerErrorNoPermission struct {
Msg string
}
BServerErrorNoPermission is an exportable error from bserver
func (BServerErrorNoPermission) Error ¶
func (e BServerErrorNoPermission) Error() string
Error implements the Error interface for BServerErrorNoPermission.
func (BServerErrorNoPermission) ToStatus ¶
func (e BServerErrorNoPermission) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorBlockArchived
type BServerErrorNonceNonExistent ¶
type BServerErrorNonceNonExistent struct {
Msg string
}
BServerErrorNonceNonExistent is an exportable error from bserver
func (BServerErrorNonceNonExistent) Error ¶
func (e BServerErrorNonceNonExistent) Error() string
Error implements the Error interface for BServerErrornonceNonExistent.
func (BServerErrorNonceNonExistent) ToStatus ¶
func (e BServerErrorNonceNonExistent) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorNonceNonExistent
type BServerErrorOverQuota ¶
type BServerErrorOverQuota struct { Msg string // Usage indicates the current usage Usage int64 // Limit indicates the current quota limit Limit int64 // Throttled indicates if request has not been completed due to server throttle Throttled bool }
BServerErrorOverQuota is a generic client-side error.
func (BServerErrorOverQuota) Error ¶
func (e BServerErrorOverQuota) Error() string
Error implements the Error interface for BServerErrorOverQuota.
func (BServerErrorOverQuota) ToStatus ¶
func (e BServerErrorOverQuota) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorOverQuota.
type BServerErrorThrottle ¶
type BServerErrorThrottle struct {
Msg string
}
BServerErrorThrottle is returned when the server wants the client to backoff.
func (BServerErrorThrottle) Error ¶
func (e BServerErrorThrottle) Error() string
Error implements the Error interface for BServerErrorThrottle.
func (BServerErrorThrottle) ToStatus ¶
func (e BServerErrorThrottle) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorThrottle.
type BServerErrorUnauthorized ¶
type BServerErrorUnauthorized struct {
}BServerErrorUnauthorized is a generic client-side error.
func (BServerErrorUnauthorized) Errno ¶
func (e BServerErrorUnauthorized) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for BServerErrorUnauthorized.
func (BServerErrorUnauthorized) Error ¶
func (e BServerErrorUnauthorized) Error() string
Error implements the Error interface for BServerErrorUnauthorized.
func (BServerErrorUnauthorized) ToStatus ¶
func (e BServerErrorUnauthorized) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for BServerErrorUnauthorized.
type BServerErrorUnwrapper ¶
type BServerErrorUnwrapper struct{}
BServerErrorUnwrapper unwraps errors from a remote block server.
func (BServerErrorUnwrapper) MakeArg ¶
func (eu BServerErrorUnwrapper) MakeArg() interface{}
MakeArg implements rpc.ErrorUnwrapper.
func (BServerErrorUnwrapper) UnwrapError ¶
func (eu BServerErrorUnwrapper) UnwrapError(arg interface{}) (appError error, dispatchError error)
UnwrapError implements rpc.ErrorUnwrapper.
type Context ¶
type Context struct { // Creator is the UID that was first charged for the initial // reference to this block. Creator keybase1.UID `codec:"c"` // Writer is the UID that should be charged for this reference to // the block. If empty, it defaults to Creator. Writer keybase1.UID `codec:"w,omitempty"` // When RefNonce is all 0s, this is the initial reference to a // particular block. Using a constant refnonce for the initial // reference allows the server to identify and optimize for the // common case where there is only one reference for a block. Two // initial references cannot happen simultaneously, because the // encrypted block contents (and thus the block ID) will be // randomized by the server-side block crypt key half. All // subsequent references to the same block must have a random // RefNonce (it can't be a monotonically increasing number because // that would require coordination among clients). RefNonce RefNonce `codec:"r,omitempty"` }
Context contains all the information used by the server to identify blocks (other than the ID).
NOTE: Don't add or modify anything in this struct without considering how old clients will handle them.
func MakeContext ¶
MakeContext makes a context with the given creator, writer, and nonce, where the writer is not necessarily equal to the creator, and the nonce is usually non-zero.
func MakeFirstContext ¶
MakeFirstContext makes the initial context for a block with the given creator.
func (Context) GetCreator ¶
GetCreator returns the creator of the associated block.
func (Context) GetRefNonce ¶
GetRefNonce returns the ref nonce of the associated block.
func (Context) IsFirstRef ¶
IsFirstRef returns whether or not p represents the first reference to the corresponding ID.
type ContextMap ¶
ContextMap is a map from a block ID to a list of its contexts.
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID is the (usually content-based) ID for a data block.
func FakeIDAdd ¶
FakeIDAdd returns an ID derived from the given ID and the given byte, suitable for testing.
func FakeIDMul ¶
FakeIDMul returns an ID derived from the given ID and given byte using *, suitable for testing.
TODO: Fix the test that breaks when this is replaced with FakeIDAdd.
func IDFromString ¶
IDFromString creates a ID from the given string. If the returned error is nil, the returned ID is valid.
func MakePermanentID ¶
MakePermanentID computes the permanent ID of a block given its encoded and encrypted contents.
func MakeTemporaryID ¶
MakeTemporaryID generates a temporary block ID using a CSPRNG. This is used for indirect blocks before they're committed to the server.
func (ID) IsValid ¶
IsValid returns whether the block ID is valid. A zero block ID is considered invalid.
func (ID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for ID. Returns an error if the ID is invalid and not the zero ID.
func (ID) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for ID.
func (*ID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for ID. Returns an error if the given byte array is non-empty and the ID is invalid.
func (*ID) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for ID.
type RefNonce ¶
type RefNonce [8]byte
RefNonce is a 64-bit unique sequence of bytes for identifying this reference of a block ID from other references to the same (duplicated) block.
func MakeRefNonce ¶
MakeRefNonce generates a non-zero block reference nonce using a CSPRNG. This is used for distinguishing different references to the same ID.
type UsageStat ¶
type UsageStat struct { Bytes map[UsageType]int64 Blocks map[UsageType]int64 // Mtime is in unix nanoseconds Mtime int64 }
UsageStat tracks the amount of bytes/blocks used, broken down by usage types
func (*UsageStat) Accum ¶
Accum combines changes to the existing UserQuotaInfo object using accumulation function accumF.
type UsageType ¶
type UsageType int
UsageType indicates the type of usage that quota manager is keeping stats of
type UserQuotaInfo ¶
UserQuotaInfo contains a user's quota usage information
func NewUserQuotaInfo ¶
func NewUserQuotaInfo() *UserQuotaInfo
NewUserQuotaInfo returns a newly constructed UserQuotaInfo.
func UserQuotaInfoDecode ¶
func UserQuotaInfoDecode(b []byte, codec kbfscodec.Codec) ( *UserQuotaInfo, error)
UserQuotaInfoDecode decodes b into a UserQuotaInfo
func (*UserQuotaInfo) Accum ¶
func (u *UserQuotaInfo) Accum(another *UserQuotaInfo, accumF func(int64, int64) int64)
Accum combines changes to the existing UserQuotaInfo object using accumulation function accumF.