Documentation
¶
Index ¶
- Constants
- Variables
- func AddDeviceForLocalUserOrBust(t logger.TestLogBackend, config Config, uid keybase1.UID) int
- func AddNewAssertionForTest(config Config, oldAssertion, newAssertion string) error
- func AddNewAssertionForTestOrBust(t logger.TestLogBackend, config Config, oldAssertion, newAssertion string)
- func AddNewKeysOrBust(t logger.TestLogBackend, rmd *RootMetadata, wkb TLFWriterKeyBundle, ...)
- func BoolForString(s string) bool
- func CheckConfigAndShutdown(t logger.TestLogBackend, config Config)
- func CheckTlfHandleOffline(ctx context.Context, name string, public bool) error
- func CodecEqual(c Codec, x, y interface{}) (bool, error)
- func CodecUpdate(c Codec, dst interface{}, src interface{}) error
- func ConvertIdentifyError(assertion string, err error) error
- func DisableCRForTesting(config Config, folderBranch FolderBranch) error
- func DisableUpdatesForTesting(config Config, folderBranch FolderBranch) (chan<- struct{}, error)
- func DoRawDefaultHash(p []byte) (HashType, RawDefaultHash)
- func ForceQuotaReclamationForTesting(config Config, folderBranch FolderBranch) error
- func GetDefaultBServer(ctx Context) string
- func GetDefaultMDServer(ctx Context) string
- func GetRootCerts(serverAddr string) []byte
- func InitLog(params InitParams, ctx Context) (logger.Logger, error)
- func LogTagsFromContext(ctx context.Context) (map[interface{}]string, bool)
- func LogTagsFromContextToMap(ctx context.Context) (tags map[string]string)
- func MakeRandomRequestID() (string, error)
- func NewReadAccessError(h *TlfHandle, username libkb.NormalizedUsername) error
- func NewRekeyPermissionError(dir *TlfHandle, username libkb.NormalizedUsername) error
- func NewSharedKeybaseConnection(kbCtx Context, config Config, handler rpc.ConnectionHandler) *rpc.Connection
- func NewTlfHandleExtensionSuffix(extensions []TlfHandleExtension) string
- func NewWriteAccessError(h *TlfHandle, username libkb.NormalizedUsername) error
- func RegisterOps(codec Codec)
- func RestartCRForTesting(baseCtx context.Context, config Config, folderBranch FolderBranch) error
- func RevokeDeviceForLocalUserOrBust(t logger.TestLogBackend, config Config, uid keybase1.UID, index int)
- func Shutdown()
- func StallBlockOp(ctx context.Context, config Config, stalledOp StallableBlockOp) (onStalled <-chan struct{}, unstall chan<- struct{}, newCtx context.Context)
- func StallMDOp(ctx context.Context, config Config, stalledOp StallableMDOp) (onStalled <-chan struct{}, unstall chan<- struct{}, newCtx context.Context)
- func SwitchDeviceForLocalUserOrBust(t logger.TestLogBackend, config Config, index int)
- func VersionString() string
- type AuthToken
- type AuthTokenRefreshHandler
- type BServerError
- type BServerErrorBadRequest
- type BServerErrorBlockArchived
- type BServerErrorBlockDeleted
- type BServerErrorBlockNonExistent
- type BServerErrorMaxRefExceeded
- type BServerErrorNoPermission
- type BServerErrorNonceNonExistent
- type BServerErrorOverQuota
- type BServerErrorThrottle
- type BServerErrorUnauthorized
- type BadCryptoError
- type BadCryptoMDError
- type BadDataError
- type BadMDError
- type BadSplitError
- type BadTLFNameError
- type BareRootMetadata
- type BareRootMetadataSignedV2
- type BareRootMetadataV2
- func (md *BareRootMetadataV2) AddDiskUsage(diskUsage uint64)
- func (md *BareRootMetadataV2) AddNewKeys(wkb TLFWriterKeyBundle, rkb TLFReaderKeyBundle)
- func (md *BareRootMetadataV2) AddRefBytes(refBytes uint64)
- func (md *BareRootMetadataV2) AddUnrefBytes(unrefBytes uint64)
- func (md *BareRootMetadataV2) BID() BranchID
- func (md *BareRootMetadataV2) CheckValidSuccessor(currID MdID, nextMd BareRootMetadata) error
- func (md *BareRootMetadataV2) CheckValidSuccessorForServer(currID MdID, nextMd BareRootMetadata) error
- func (md *BareRootMetadataV2) ClearFinalBit()
- func (md *BareRootMetadataV2) ClearRekeyBit()
- func (md *BareRootMetadataV2) ClearWriterMetadataCopiedBit()
- func (md *BareRootMetadataV2) DeepCopy(codec Codec) (BareRootMetadata, error)
- func (md *BareRootMetadataV2) DiskUsage() uint64
- func (md *BareRootMetadataV2) FakeInitialRekey(h BareTlfHandle)
- func (md *BareRootMetadataV2) GetDeviceKIDs(keyGen KeyGen, user keybase1.UID) ([]keybase1.KID, error)
- func (md *BareRootMetadataV2) GetLastModifyingUser() keybase1.UID
- func (md *BareRootMetadataV2) GetPrevRoot() MdID
- func (md *BareRootMetadataV2) GetSerializedPrivateMetadata() []byte
- func (md *BareRootMetadataV2) GetSerializedWriterMetadata(codec Codec) ([]byte, error)
- func (md *BareRootMetadataV2) GetTLFCryptKeyParams(keyGen KeyGen, user keybase1.UID, key CryptPublicKey) (TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, TLFCryptKeyServerHalfID, ...)
- func (md *BareRootMetadataV2) GetTLFKeyBundles(keyGen KeyGen) (*TLFWriterKeyBundle, *TLFReaderKeyBundle, error)
- func (md *BareRootMetadataV2) GetWriterMetadataSigInfo() SignatureInfo
- func (md *BareRootMetadataV2) HasKeyForUser(keyGen KeyGen, user keybase1.UID) bool
- func (md *BareRootMetadataV2) IsFinal() bool
- func (md *BareRootMetadataV2) IsLastModifiedBy(uid keybase1.UID, key VerifyingKey) error
- func (md *BareRootMetadataV2) IsReader(user keybase1.UID, deviceKID keybase1.KID) bool
- func (md *BareRootMetadataV2) IsRekeySet() bool
- func (md *BareRootMetadataV2) IsUnmergedSet() bool
- func (md *BareRootMetadataV2) IsValidAndSigned(codec Codec, crypto cryptoPure) error
- func (md *BareRootMetadataV2) IsValidRekeyRequest(codec Codec, prevBareMd BareRootMetadata, user keybase1.UID) (bool, error)
- func (md *BareRootMetadataV2) IsWriter(user keybase1.UID, deviceKID keybase1.KID) bool
- func (md *BareRootMetadataV2) IsWriterMetadataCopiedSet() bool
- func (md *BareRootMetadataV2) LastModifyingWriter() keybase1.UID
- func (md *BareRootMetadataV2) LastModifyingWriterKID() keybase1.KID
- func (md *BareRootMetadataV2) LatestKeyGeneration() KeyGen
- func (md *BareRootMetadataV2) MakeBareTlfHandle() (BareTlfHandle, error)
- func (md *BareRootMetadataV2) MergedStatus() MergeStatus
- func (md *BareRootMetadataV2) RefBytes() uint64
- func (md *BareRootMetadataV2) RevisionNumber() MetadataRevision
- func (md *BareRootMetadataV2) SetBranchID(bid BranchID)
- func (md *BareRootMetadataV2) SetConflictInfo(ci *TlfHandleExtension)
- func (md *BareRootMetadataV2) SetDiskUsage(diskUsage uint64)
- func (md *BareRootMetadataV2) SetFinalBit()
- func (md *BareRootMetadataV2) SetFinalizedInfo(fi *TlfHandleExtension)
- func (md *BareRootMetadataV2) SetLastModifyingUser(user keybase1.UID)
- func (md *BareRootMetadataV2) SetLastModifyingWriter(user keybase1.UID)
- func (md *BareRootMetadataV2) SetPrevRoot(mdID MdID)
- func (md *BareRootMetadataV2) SetRefBytes(refBytes uint64)
- func (md *BareRootMetadataV2) SetRekeyBit()
- func (md *BareRootMetadataV2) SetRevision(revision MetadataRevision)
- func (md *BareRootMetadataV2) SetSerializedPrivateMetadata(spmd []byte)
- func (md *BareRootMetadataV2) SetTlfID(tlf TlfID)
- func (md *BareRootMetadataV2) SetUnmerged()
- func (md *BareRootMetadataV2) SetUnrefBytes(unrefBytes uint64)
- func (md *BareRootMetadataV2) SetUnresolvedReaders(readers []keybase1.SocialAssertion)
- func (md *BareRootMetadataV2) SetUnresolvedWriters(writers []keybase1.SocialAssertion)
- func (md *BareRootMetadataV2) SetWriterMetadataCopiedBit()
- func (md *BareRootMetadataV2) SetWriterMetadataSigInfo(sigInfo SignatureInfo)
- func (md *BareRootMetadataV2) SetWriters(writers []keybase1.UID)
- func (md *BareRootMetadataV2) TlfHandleExtensions() (extensions []TlfHandleExtension)
- func (md *BareRootMetadataV2) TlfID() TlfID
- func (md *BareRootMetadataV2) UnrefBytes() uint64
- func (md *BareRootMetadataV2) Update(id TlfID, h BareTlfHandle) error
- func (md *BareRootMetadataV2) Version() MetadataVer
- type BareTlfHandle
- func (h BareTlfHandle) Extensions() (extensions []TlfHandleExtension)
- func (h BareTlfHandle) HasUnresolvedUsers() bool
- func (h BareTlfHandle) IsConflict() bool
- func (h BareTlfHandle) IsFinal() bool
- func (h BareTlfHandle) IsPublic() bool
- func (h BareTlfHandle) IsReader(user keybase1.UID) bool
- func (h BareTlfHandle) IsWriter(user keybase1.UID) bool
- func (h BareTlfHandle) ResolveAssertions(assertions map[keybase1.SocialAssertion]keybase1.UID) BareTlfHandle
- func (h BareTlfHandle) ResolvedUsers() []keybase1.UID
- func (h BareTlfHandle) UnresolvedUsers() []keybase1.SocialAssertion
- type Block
- type BlockCache
- type BlockCacheLifetime
- type BlockCacheStandard
- func (b *BlockCacheStandard) CheckForKnownPtr(tlf TlfID, block *FileBlock) (BlockPointer, error)
- func (b *BlockCacheStandard) DeleteKnownPtr(tlf TlfID, block *FileBlock) error
- func (b *BlockCacheStandard) DeletePermanent(id BlockID) error
- func (b *BlockCacheStandard) DeleteTransient(ptr BlockPointer, tlf TlfID) error
- func (b *BlockCacheStandard) Get(ptr BlockPointer) (Block, error)
- func (b *BlockCacheStandard) Put(ptr BlockPointer, tlf TlfID, block Block, lifetime BlockCacheLifetime) error
- type BlockChanges
- func (bc *BlockChanges) AddOp(o op)
- func (bc *BlockChanges) AddRefBlock(ptr BlockPointer)
- func (bc *BlockChanges) AddUnrefBlock(ptr BlockPointer)
- func (bc *BlockChanges) AddUpdate(oldPtr BlockPointer, newPtr BlockPointer)
- func (bc BlockChanges) Equals(other BlockChanges) bool
- func (bc *BlockChanges) SizeEstimate() uint64
- type BlockContext
- type BlockCryptKey
- type BlockCryptKeyServerHalf
- type BlockDecodeError
- type BlockID
- type BlockInfo
- type BlockOps
- type BlockOpsConstrained
- type BlockOpsStandard
- func (b *BlockOpsStandard) Archive(ctx context.Context, tlfID TlfID, ptrs []BlockPointer) error
- func (b *BlockOpsStandard) Delete(ctx context.Context, tlfID TlfID, ptrs []BlockPointer) (liveCounts map[BlockID]int, err error)
- func (b *BlockOpsStandard) Get(ctx context.Context, kmd KeyMetadata, blockPtr BlockPointer, block Block) error
- func (b *BlockOpsStandard) Put(ctx context.Context, tlfID TlfID, blockPtr BlockPointer, ...) error
- func (b *BlockOpsStandard) Ready(ctx context.Context, kmd KeyMetadata, block Block) (id BlockID, plainSize int, readyBlockData ReadyBlockData, err error)
- type BlockPointer
- type BlockRefNonce
- type BlockServer
- type BlockServerDisk
- func (b *BlockServerDisk) AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) error
- func (b *BlockServerDisk) ArchiveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) error
- func (b *BlockServerDisk) Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) ([]byte, BlockCryptKeyServerHalf, error)
- func (b *BlockServerDisk) GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
- func (b *BlockServerDisk) Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext, buf []byte, ...) error
- func (b *BlockServerDisk) RefreshAuthToken(_ context.Context)
- func (b *BlockServerDisk) RemoveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (liveCounts map[BlockID]int, err error)
- func (b *BlockServerDisk) Shutdown()
- type BlockServerMeasured
- func (b BlockServerMeasured) AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) (err error)
- func (b BlockServerMeasured) ArchiveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (err error)
- func (b BlockServerMeasured) Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) (buf []byte, serverHalf BlockCryptKeyServerHalf, err error)
- func (b BlockServerMeasured) GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
- func (b BlockServerMeasured) Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext, buf []byte, ...) (err error)
- func (b BlockServerMeasured) RefreshAuthToken(ctx context.Context)
- func (b BlockServerMeasured) RemoveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (liveCounts map[BlockID]int, err error)
- func (b BlockServerMeasured) Shutdown()
- type BlockServerMemory
- func (b *BlockServerMemory) AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) error
- func (b *BlockServerMemory) ArchiveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) error
- func (b *BlockServerMemory) Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) ([]byte, BlockCryptKeyServerHalf, error)
- func (b *BlockServerMemory) GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
- func (b *BlockServerMemory) Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext, buf []byte, ...) error
- func (b *BlockServerMemory) RefreshAuthToken(_ context.Context)
- func (b *BlockServerMemory) RemoveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (liveCounts map[BlockID]int, err error)
- func (b *BlockServerMemory) Shutdown()
- type BlockServerRemote
- func (b *BlockServerRemote) AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) error
- func (b *BlockServerRemote) ArchiveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (err error)
- func (b *BlockServerRemote) Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) ([]byte, BlockCryptKeyServerHalf, error)
- func (b *BlockServerRemote) GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
- func (*BlockServerRemote) HandlerName() string
- func (b *BlockServerRemote) OnConnect(ctx context.Context, _ *rpc.Connection, client rpc.GenericClient, ...) error
- func (b *BlockServerRemote) OnConnectError(err error, wait time.Duration)
- func (b *BlockServerRemote) OnDisconnected(ctx context.Context, status rpc.DisconnectStatus)
- func (b *BlockServerRemote) OnDoCommandError(err error, wait time.Duration)
- func (b *BlockServerRemote) Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext, buf []byte, ...) error
- func (b *BlockServerRemote) RefreshAuthToken(ctx context.Context)
- func (b *BlockServerRemote) RemoteAddress() string
- func (b *BlockServerRemote) RemoveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (liveCounts map[BlockID]int, err error)
- func (b *BlockServerRemote) ShouldRetry(rpcName string, err error) bool
- func (b *BlockServerRemote) ShouldRetryOnConnect(err error) bool
- func (b *BlockServerRemote) Shutdown()
- type BlockSplitter
- type BlockSplitterSimple
- type BranchID
- type BranchName
- type CRAbandonStagedBranchError
- type CRWrapError
- type CanonicalTlfName
- type Clock
- type Codec
- type CodecMsgpack
- func (c *CodecMsgpack) Decode(buf []byte, obj interface{}) (err error)
- func (c *CodecMsgpack) Encode(obj interface{}) (buf []byte, err error)
- func (c *CodecMsgpack) RegisterIfaceSliceType(rt reflect.Type, code extCode, typer func(interface{}) reflect.Value)
- func (c *CodecMsgpack) RegisterType(rt reflect.Type, code extCode)
- type CommonBlock
- type Config
- type ConfigLocal
- func ConfigAsUser(config *ConfigLocal, loggedInUser libkb.NormalizedUsername) *ConfigLocal
- func MakeTestConfigOrBust(t logger.TestLogBackend, users ...libkb.NormalizedUsername) *ConfigLocal
- func NewConfigLocal() *ConfigLocal
- func NewConfigLocalWithCrypto() *ConfigLocal
- func NewConfigLocalWithCryptoForSigning(signingKey SigningKey) *ConfigLocal
- func (c *ConfigLocal) BlockCache() BlockCache
- func (c *ConfigLocal) BlockOps() BlockOps
- func (c *ConfigLocal) BlockServer() BlockServer
- func (c *ConfigLocal) BlockSplitter() BlockSplitter
- func (c *ConfigLocal) CheckStateOnShutdown() bool
- func (c *ConfigLocal) Clock() Clock
- func (c *ConfigLocal) Codec() Codec
- func (c *ConfigLocal) ConflictRenamer() ConflictRenamer
- func (c *ConfigLocal) Crypto() Crypto
- func (c *ConfigLocal) DataVersion() DataVer
- func (c *ConfigLocal) DirtyBlockCache() DirtyBlockCache
- func (c *ConfigLocal) DoBackgroundFlushes() bool
- func (c *ConfigLocal) KBFSOps() KBFSOps
- func (c *ConfigLocal) KBPKI() KBPKI
- func (c *ConfigLocal) KeyCache() KeyCache
- func (c *ConfigLocal) KeyManager() KeyManager
- func (c *ConfigLocal) KeyOps() KeyOps
- func (c *ConfigLocal) KeyServer() KeyServer
- func (c *ConfigLocal) KeybaseService() KeybaseService
- func (c *ConfigLocal) MDCache() MDCache
- func (c *ConfigLocal) MDOps() MDOps
- func (c *ConfigLocal) MDServer() MDServer
- func (c *ConfigLocal) MakeLogger(module string) logger.Logger
- func (c *ConfigLocal) MaxDirBytes() uint64
- func (c *ConfigLocal) MaxFileBytes() uint64
- func (c *ConfigLocal) MaxNameBytes() uint32
- func (c *ConfigLocal) MetadataVersion() MetadataVer
- func (c *ConfigLocal) MetricsRegistry() metrics.Registry
- func (c *ConfigLocal) Notifier() Notifier
- func (c *ConfigLocal) QuotaReclamationMinUnrefAge() time.Duration
- func (c *ConfigLocal) QuotaReclamationPeriod() time.Duration
- func (c *ConfigLocal) RekeyQueue() RekeyQueue
- func (c *ConfigLocal) RekeyWithPromptWaitTime() time.Duration
- func (c *ConfigLocal) Reporter() Reporter
- func (c *ConfigLocal) ReqsBufSize() int
- func (c *ConfigLocal) ResetCaches()
- func (c *ConfigLocal) SetBlockCache(b BlockCache)
- func (c *ConfigLocal) SetBlockOps(b BlockOps)
- func (c *ConfigLocal) SetBlockServer(b BlockServer)
- func (c *ConfigLocal) SetBlockSplitter(b BlockSplitter)
- func (c *ConfigLocal) SetClock(cl Clock)
- func (c *ConfigLocal) SetCodec(co Codec)
- func (c *ConfigLocal) SetConflictRenamer(cr ConflictRenamer)
- func (c *ConfigLocal) SetCrypto(cr Crypto)
- func (c *ConfigLocal) SetDirtyBlockCache(d DirtyBlockCache)
- func (c *ConfigLocal) SetDoBackgroundFlushes(doBGFlush bool)
- func (c *ConfigLocal) SetKBFSOps(k KBFSOps)
- func (c *ConfigLocal) SetKBPKI(k KBPKI)
- func (c *ConfigLocal) SetKeyCache(k KeyCache)
- func (c *ConfigLocal) SetKeyManager(k KeyManager)
- func (c *ConfigLocal) SetKeyOps(k KeyOps)
- func (c *ConfigLocal) SetKeyServer(k KeyServer)
- func (c *ConfigLocal) SetKeybaseService(k KeybaseService)
- func (c *ConfigLocal) SetLoggerMaker(loggerFn func(module string) logger.Logger)
- func (c *ConfigLocal) SetMDCache(m MDCache)
- func (c *ConfigLocal) SetMDOps(m MDOps)
- func (c *ConfigLocal) SetMDServer(m MDServer)
- func (c *ConfigLocal) SetMetricsRegistry(r metrics.Registry)
- func (c *ConfigLocal) SetNotifier(n Notifier)
- func (c *ConfigLocal) SetRekeyQueue(r RekeyQueue)
- func (c *ConfigLocal) SetReporter(r Reporter)
- func (c *ConfigLocal) SetTLFValidDuration(r time.Duration)
- func (c *ConfigLocal) Shutdown() error
- func (c *ConfigLocal) TLFValidDuration() time.Duration
- type ConflictRenamer
- type ConflictResolver
- type Context
- type CryptPrivateKey
- type CryptPrivateKeySecret
- type CryptPublicKey
- type Crypto
- type CryptoClient
- func (c *CryptoClient) DecryptTLFCryptKeyClientHalf(ctx context.Context, publicKey TLFEphemeralPublicKey, ...) (clientHalf TLFCryptKeyClientHalf, err error)
- func (c *CryptoClient) DecryptTLFCryptKeyClientHalfAny(ctx context.Context, keys []EncryptedTLFCryptKeyClientAndEphemeral, ...) (clientHalf TLFCryptKeyClientHalf, index int, err error)
- func (c *CryptoClient) Shutdown()
- func (c *CryptoClient) Sign(ctx context.Context, msg []byte) (sigInfo SignatureInfo, err error)
- func (c *CryptoClient) SignToString(ctx context.Context, msg []byte) (signature string, err error)
- type CryptoClientRPC
- func (CryptoClientRPC) HandlerName() string
- func (c *CryptoClientRPC) OnConnect(ctx context.Context, conn *rpc.Connection, _ rpc.GenericClient, ...) error
- func (c *CryptoClientRPC) OnConnectError(err error, wait time.Duration)
- func (c *CryptoClientRPC) OnDisconnected(_ context.Context, status rpc.DisconnectStatus)
- func (c *CryptoClientRPC) OnDoCommandError(err error, wait time.Duration)
- func (c *CryptoClientRPC) ShouldRetry(rpcName string, err error) bool
- func (c *CryptoClientRPC) ShouldRetryOnConnect(err error) bool
- type CryptoCommon
- func (c CryptoCommon) DecryptBlock(encryptedBlock EncryptedBlock, key BlockCryptKey, block Block) error
- func (c CryptoCommon) DecryptMerkleLeaf(encryptedLeaf EncryptedMerkleLeaf, privKey TLFPrivateKey, nonce *[24]byte, ...) (*MerkleLeaf, error)
- func (c CryptoCommon) DecryptPrivateMetadata(encryptedPmd EncryptedPrivateMetadata, key TLFCryptKey) (*PrivateMetadata, error)
- func (c CryptoCommon) EncryptBlock(block Block, key BlockCryptKey) (plainSize int, encryptedBlock EncryptedBlock, err error)
- func (c CryptoCommon) EncryptMerkleLeaf(leaf MerkleLeaf, pubKey TLFPublicKey, nonce *[24]byte, ...) (EncryptedMerkleLeaf, error)
- func (c CryptoCommon) EncryptPrivateMetadata(pmd *PrivateMetadata, key TLFCryptKey) (encryptedPmd EncryptedPrivateMetadata, err error)
- func (c CryptoCommon) EncryptTLFCryptKeyClientHalf(privateKey TLFEphemeralPrivateKey, publicKey CryptPublicKey, ...) (encryptedClientHalf EncryptedTLFCryptKeyClientHalf, err error)
- func (c CryptoCommon) GetTLFCryptKeyServerHalfID(user keybase1.UID, deviceKID keybase1.KID, serverHalf TLFCryptKeyServerHalf) (TLFCryptKeyServerHalfID, error)
- func (c CryptoCommon) MakeBlockRefNonce() (nonce BlockRefNonce, err error)
- func (c CryptoCommon) MakeMdID(md BareRootMetadata) (MdID, error)
- func (c CryptoCommon) MakeMerkleHash(md *RootMetadataSigned) (MerkleHash, error)
- func (c CryptoCommon) MakePermanentBlockID(encodedEncryptedData []byte) (BlockID, error)
- func (c CryptoCommon) MakeRandomBlockCryptKeyServerHalf() (serverHalf BlockCryptKeyServerHalf, err error)
- func (c CryptoCommon) MakeRandomBranchID() (BranchID, error)
- func (c CryptoCommon) MakeRandomTLFCryptKeyServerHalf() (serverHalf TLFCryptKeyServerHalf, err error)
- func (c CryptoCommon) MakeRandomTLFKeys() (tlfPublicKey TLFPublicKey, tlfPrivateKey TLFPrivateKey, ...)
- func (c CryptoCommon) MakeRandomTlfID(isPublic bool) (TlfID, error)
- func (c CryptoCommon) MakeTemporaryBlockID() (BlockID, error)
- func (c CryptoCommon) MaskTLFCryptKey(serverHalf TLFCryptKeyServerHalf, key TLFCryptKey) (clientHalf TLFCryptKeyClientHalf, err error)
- func (c CryptoCommon) UnmaskBlockCryptKey(serverHalf BlockCryptKeyServerHalf, tlfCryptKey TLFCryptKey) (key BlockCryptKey, error error)
- func (c CryptoCommon) UnmaskTLFCryptKey(serverHalf TLFCryptKeyServerHalf, clientHalf TLFCryptKeyClientHalf) (key TLFCryptKey, err error)
- func (c CryptoCommon) Verify(msg []byte, sigInfo SignatureInfo) (err error)
- func (c CryptoCommon) VerifyBlockID(encodedEncryptedData []byte, id BlockID) error
- func (c CryptoCommon) VerifyTLFCryptKeyServerHalfID(serverHalfID TLFCryptKeyServerHalfID, user keybase1.UID, ...) error
- type CryptoLocal
- func (c CryptoLocal) DecryptTLFCryptKeyClientHalf(ctx context.Context, publicKey TLFEphemeralPublicKey, ...) (clientHalf TLFCryptKeyClientHalf, err error)
- func (c CryptoLocal) DecryptTLFCryptKeyClientHalfAny(ctx context.Context, keys []EncryptedTLFCryptKeyClientAndEphemeral, _ bool) (clientHalf TLFCryptKeyClientHalf, index int, err error)
- func (c CryptoLocal) Shutdown()
- func (c CryptoLocal) Sign(ctx context.Context, msg []byte) (sigInfo SignatureInfo, err error)
- func (c CryptoLocal) SignToString(ctx context.Context, msg []byte) (signature string, err error)
- type CryptoMeasured
- type CtxCRTagKey
- type CtxFBMTagKey
- type CtxFBOTagKey
- type CtxKeybaseServiceTagKey
- type CtxMDSRTagKey
- type CtxRekeyTagKey
- type DataVer
- type DeviceKeyInfoMap
- type DirBlock
- type DirEntry
- type DirNotEmptyError
- type DirTooBigError
- type DirtyBlockCache
- type DirtyBlockCacheStandard
- func (d *DirtyBlockCacheStandard) BlockSyncFinished(size int64)
- func (d *DirtyBlockCacheStandard) Delete(ptr BlockPointer, branch BranchName) error
- func (d *DirtyBlockCacheStandard) Get(ptr BlockPointer, branch BranchName) (Block, error)
- func (d *DirtyBlockCacheStandard) IsDirty(ptr BlockPointer, branch BranchName) (isDirty bool)
- func (d *DirtyBlockCacheStandard) Put(ptr BlockPointer, branch BranchName, block Block) error
- func (d *DirtyBlockCacheStandard) RequestPermissionToDirty(ctx context.Context, estimatedDirtyBytes int64) (DirtyPermChan, error)
- func (d *DirtyBlockCacheStandard) ShouldForceSync() bool
- func (d *DirtyBlockCacheStandard) Shutdown() error
- func (d *DirtyBlockCacheStandard) SyncFinished(size int64)
- func (d *DirtyBlockCacheStandard) UpdateSyncingBytes(size int64)
- func (d *DirtyBlockCacheStandard) UpdateUnsyncedBytes(newUnsyncedBytes int64, wasSyncing bool)
- type DirtyPermChan
- type DisallowedPrefixError
- type EmptyNameError
- type EncryptedBlock
- type EncryptedMerkleLeaf
- type EncryptedPrivateMetadata
- type EncryptedTLFCryptKeyClientAndEphemeral
- type EncryptedTLFCryptKeyClientHalf
- type EncryptionVer
- type EntryInfo
- type EntryType
- type ErrorFileAccessError
- type ErrorModeType
- type Excl
- type ExclOnUnmergedError
- type Favorite
- type Favorites
- func (f *Favorites) Add(ctx context.Context, fav favToAdd) error
- func (f *Favorites) AddAsync(ctx context.Context, fav favToAdd)
- func (f *Favorites) Delete(ctx context.Context, fav Favorite) error
- func (f *Favorites) Get(ctx context.Context) ([]Favorite, error)
- func (f *Favorites) RefreshCache(ctx context.Context)
- func (f *Favorites) Shutdown() error
- type FileBlock
- type FileTooBigError
- type FolderBranch
- type FolderBranchStatus
- type HMAC
- type Hash
- type HashMismatchError
- type HashType
- type ImmutableBareRootMetadata
- type ImmutableRootMetadata
- type IncompatibleHandleError
- type InconsistentEncodedSizeError
- type IndirectDirPtr
- type IndirectFilePtr
- type InitParams
- type InvalidBlockRefError
- type InvalidBranchID
- type InvalidByte32DataError
- type InvalidDataVersionError
- type InvalidHashError
- type InvalidKIDError
- type InvalidKeyGenerationError
- type InvalidMetadataVersionError
- type InvalidNonceError
- type InvalidOpError
- type InvalidParentPathError
- type InvalidPathError
- type InvalidPublicTLFOperation
- type InvalidTlfID
- type JournalServer
- func (j *JournalServer) Disable(ctx context.Context, tlfID TlfID) (err error)
- func (j *JournalServer) Enable(ctx context.Context, tlfID TlfID) (err error)
- func (j *JournalServer) EnableExistingJournals(ctx context.Context) (err error)
- func (j *JournalServer) Flush(ctx context.Context, tlfID TlfID) (err error)
- func (j *JournalServer) JournalStatus(tlfID TlfID) (TLFJournalStatus, error)
- func (j *JournalServer) Status() JournalServerStatus
- type JournalServerStatus
- type KBFSOps
- type KBFSOpsStandard
- func (fs *KBFSOpsStandard) AddFavorite(ctx context.Context, fav Favorite) error
- func (fs *KBFSOpsStandard) CreateDir(ctx context.Context, dir Node, name string) (Node, EntryInfo, error)
- func (fs *KBFSOpsStandard) CreateFile(ctx context.Context, dir Node, name string, isExec bool, excl Excl) (Node, EntryInfo, error)
- func (fs *KBFSOpsStandard) CreateLink(ctx context.Context, dir Node, fromName string, toPath string) (EntryInfo, error)
- func (fs *KBFSOpsStandard) DeleteFavorite(ctx context.Context, fav Favorite) error
- func (fs *KBFSOpsStandard) FolderStatus(ctx context.Context, folderBranch FolderBranch) (FolderBranchStatus, <-chan StatusUpdate, error)
- func (fs *KBFSOpsStandard) GetDirChildren(ctx context.Context, dir Node) (map[string]EntryInfo, error)
- func (fs *KBFSOpsStandard) GetEditHistory(ctx context.Context, folderBranch FolderBranch) (edits TlfWriterEdits, err error)
- func (fs *KBFSOpsStandard) GetFavorites(ctx context.Context) ([]Favorite, error)
- func (fs *KBFSOpsStandard) GetOrCreateRootNode(ctx context.Context, h *TlfHandle, branch BranchName) (node Node, ei EntryInfo, err error)
- func (fs *KBFSOpsStandard) GetRootNode(ctx context.Context, h *TlfHandle, branch BranchName) (node Node, ei EntryInfo, err error)
- func (fs *KBFSOpsStandard) GetTLFCryptKeys(ctx context.Context, tlfHandle *TlfHandle) (keys []TLFCryptKey, id TlfID, err error)
- func (fs *KBFSOpsStandard) GetUpdateHistory(ctx context.Context, folderBranch FolderBranch) (history TLFUpdateHistory, err error)
- func (fs *KBFSOpsStandard) Lookup(ctx context.Context, dir Node, name string) (Node, EntryInfo, error)
- func (fs *KBFSOpsStandard) PushConnectionStatusChange(service string, newStatus error)
- func (fs *KBFSOpsStandard) Read(ctx context.Context, file Node, dest []byte, off int64) (numRead int64, err error)
- func (fs *KBFSOpsStandard) RefreshCachedFavorites(ctx context.Context)
- func (fs *KBFSOpsStandard) RegisterForChanges(folderBranches []FolderBranch, obs Observer) error
- func (fs *KBFSOpsStandard) Rekey(ctx context.Context, id TlfID) error
- func (fs *KBFSOpsStandard) RemoveDir(ctx context.Context, dir Node, name string) error
- func (fs *KBFSOpsStandard) RemoveEntry(ctx context.Context, dir Node, name string) error
- func (fs *KBFSOpsStandard) Rename(ctx context.Context, oldParent Node, oldName string, newParent Node, ...) error
- func (fs *KBFSOpsStandard) SetEx(ctx context.Context, file Node, ex bool) error
- func (fs *KBFSOpsStandard) SetMtime(ctx context.Context, file Node, mtime *time.Time) error
- func (fs *KBFSOpsStandard) Shutdown() error
- func (fs *KBFSOpsStandard) Stat(ctx context.Context, node Node) (EntryInfo, error)
- func (fs *KBFSOpsStandard) Status(ctx context.Context) (KBFSStatus, <-chan StatusUpdate, error)
- func (fs *KBFSOpsStandard) Sync(ctx context.Context, file Node) error
- func (fs *KBFSOpsStandard) SyncFromServerForTesting(ctx context.Context, folderBranch FolderBranch) error
- func (fs *KBFSOpsStandard) Truncate(ctx context.Context, file Node, size uint64) error
- func (fs *KBFSOpsStandard) UnregisterFromChanges(folderBranches []FolderBranch, obs Observer) error
- func (fs *KBFSOpsStandard) UnstageForTesting(ctx context.Context, folderBranch FolderBranch) error
- func (fs *KBFSOpsStandard) Write(ctx context.Context, file Node, data []byte, off int64) error
- type KBFSStatus
- type KBPKI
- type KBPKIClient
- func (k *KBPKIClient) FavoriteAdd(ctx context.Context, folder keybase1.Folder) error
- func (k *KBPKIClient) FavoriteDelete(ctx context.Context, folder keybase1.Folder) error
- func (k *KBPKIClient) FavoriteList(ctx context.Context) ([]keybase1.Folder, error)
- func (k *KBPKIClient) GetCryptPublicKeys(ctx context.Context, uid keybase1.UID) (keys []CryptPublicKey, err error)
- func (k *KBPKIClient) GetCurrentCryptPublicKey(ctx context.Context) (CryptPublicKey, error)
- func (k *KBPKIClient) GetCurrentToken(ctx context.Context) (string, error)
- func (k *KBPKIClient) GetCurrentUserInfo(ctx context.Context) (libkb.NormalizedUsername, keybase1.UID, error)
- func (k *KBPKIClient) GetCurrentVerifyingKey(ctx context.Context) (VerifyingKey, error)
- func (k *KBPKIClient) GetNormalizedUsername(ctx context.Context, uid keybase1.UID) (libkb.NormalizedUsername, error)
- func (k *KBPKIClient) HasUnverifiedVerifyingKey(ctx context.Context, uid keybase1.UID, verifyingKey VerifyingKey) error
- func (k *KBPKIClient) HasVerifyingKey(ctx context.Context, uid keybase1.UID, verifyingKey VerifyingKey, ...) error
- func (k *KBPKIClient) Identify(ctx context.Context, assertion, reason string) (UserInfo, error)
- func (k *KBPKIClient) Notify(ctx context.Context, notification *keybase1.FSNotification) error
- func (k *KBPKIClient) Resolve(ctx context.Context, assertion string) (libkb.NormalizedUsername, keybase1.UID, error)
- type KeyCache
- type KeyCacheHitError
- type KeyCacheMeasured
- type KeyCacheMissError
- type KeyCacheNull
- type KeyCacheStandard
- type KeyGen
- type KeyHalfMismatchError
- type KeyManager
- type KeyManagerStandard
- func (km *KeyManagerStandard) GetTLFCryptKeyForBlockDecryption(ctx context.Context, kmd KeyMetadata, blockPtr BlockPointer) (tlfCryptKey TLFCryptKey, err error)
- func (km *KeyManagerStandard) GetTLFCryptKeyForEncryption(ctx context.Context, kmd KeyMetadata) (tlfCryptKey TLFCryptKey, err error)
- func (km *KeyManagerStandard) GetTLFCryptKeyForMDDecryption(ctx context.Context, kmdToDecrypt, kmdWithKeys KeyMetadata) (tlfCryptKey TLFCryptKey, err error)
- func (km *KeyManagerStandard) GetTLFCryptKeyOfAllGenerations(ctx context.Context, kmd KeyMetadata) (keys []TLFCryptKey, err error)
- func (km *KeyManagerStandard) Rekey(ctx context.Context, md *RootMetadata, promptPaper bool) (rekeyDone bool, cryptKey *TLFCryptKey, err error)
- type KeyMetadata
- type KeyNotFoundError
- type KeyOps
- type KeyOpsStandard
- func (k *KeyOpsStandard) DeleteTLFCryptKeyServerHalf(ctx context.Context, uid keybase1.UID, kid keybase1.KID, ...) error
- func (k *KeyOpsStandard) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, key CryptPublicKey) (TLFCryptKeyServerHalf, error)
- func (k *KeyOpsStandard) PutTLFCryptKeyServerHalves(ctx context.Context, ...) error
- type KeyServer
- type KeyServerLocal
- func (ks *KeyServerLocal) DeleteTLFCryptKeyServerHalf(ctx context.Context, _ keybase1.UID, _ keybase1.KID, ...) error
- func (ks *KeyServerLocal) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, key CryptPublicKey) (serverHalf TLFCryptKeyServerHalf, err error)
- func (ks *KeyServerLocal) PutTLFCryptKeyServerHalves(ctx context.Context, ...) error
- func (ks *KeyServerLocal) Shutdown()
- type KeyServerMeasured
- func (b KeyServerMeasured) DeleteTLFCryptKeyServerHalf(ctx context.Context, uid keybase1.UID, kid keybase1.KID, ...) (err error)
- func (b KeyServerMeasured) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, key CryptPublicKey) (serverHalf TLFCryptKeyServerHalf, err error)
- func (b KeyServerMeasured) PutTLFCryptKeyServerHalves(ctx context.Context, ...) (err error)
- func (b KeyServerMeasured) Shutdown()
- type KeybaseDaemonLocal
- func (k *KeybaseDaemonLocal) CurrentSession(ctx context.Context, sessionID int) (SessionInfo, error)
- func (k *KeybaseDaemonLocal) FavoriteAdd(ctx context.Context, folder keybase1.Folder) error
- func (k *KeybaseDaemonLocal) FavoriteDelete(ctx context.Context, folder keybase1.Folder) error
- func (k *KeybaseDaemonLocal) FavoriteList(ctx context.Context, sessionID int) ([]keybase1.Folder, error)
- func (k *KeybaseDaemonLocal) FlushUserFromLocalCache(ctx context.Context, uid keybase1.UID)
- func (k *KeybaseDaemonLocal) FlushUserUnverifiedKeysFromLocalCache(ctx context.Context, uid keybase1.UID)
- func (k *KeybaseDaemonLocal) Identify(ctx context.Context, assertion, reason string) (UserInfo, error)
- func (k *KeybaseDaemonLocal) LoadUnverifiedKeys(ctx context.Context, uid keybase1.UID) ([]keybase1.PublicKey, error)
- func (k *KeybaseDaemonLocal) LoadUserPlusKeys(ctx context.Context, uid keybase1.UID) (UserInfo, error)
- func (k *KeybaseDaemonLocal) Notify(ctx context.Context, notification *keybase1.FSNotification) error
- func (k *KeybaseDaemonLocal) Resolve(ctx context.Context, assertion string) (libkb.NormalizedUsername, keybase1.UID, error)
- func (k *KeybaseDaemonLocal) Shutdown()
- type KeybaseDaemonRPC
- func (k *KeybaseDaemonRPC) AddProtocols(protocols []rpc.Protocol)
- func (*KeybaseDaemonRPC) HandlerName() string
- func (k *KeybaseDaemonRPC) OnConnect(ctx context.Context, conn *rpc.Connection, rawClient rpc.GenericClient, ...) error
- func (k *KeybaseDaemonRPC) OnConnectError(err error, wait time.Duration)
- func (k *KeybaseDaemonRPC) OnDisconnected(_ context.Context, status rpc.DisconnectStatus)
- func (k *KeybaseDaemonRPC) OnDoCommandError(err error, wait time.Duration)
- func (k *KeybaseDaemonRPC) ShouldRetry(rpcName string, err error) bool
- func (k *KeybaseDaemonRPC) ShouldRetryOnConnect(err error) bool
- func (k *KeybaseDaemonRPC) Shutdown()
- type KeybaseService
- type KeybaseServiceBase
- func (k *KeybaseServiceBase) ClientOutOfDate(ctx context.Context, arg keybase1.ClientOutOfDateArg) error
- func (k *KeybaseServiceBase) CurrentSession(ctx context.Context, sessionID int) (SessionInfo, error)
- func (k *KeybaseServiceBase) FSEditListRequest(ctx context.Context, req keybase1.FSEditListRequest) (err error)
- func (k *KeybaseServiceBase) FavoriteAdd(ctx context.Context, folder keybase1.Folder) error
- func (k *KeybaseServiceBase) FavoriteDelete(ctx context.Context, folder keybase1.Folder) error
- func (k *KeybaseServiceBase) FavoriteList(ctx context.Context, sessionID int) ([]keybase1.Folder, error)
- func (k *KeybaseServiceBase) FillClients(identifyClient keybase1.IdentifyInterface, userClient keybase1.UserInterface, ...)
- func (k *KeybaseServiceBase) FlushUserFromLocalCache(ctx context.Context, uid keybase1.UID)
- func (k *KeybaseServiceBase) FlushUserUnverifiedKeysFromLocalCache(ctx context.Context, uid keybase1.UID)
- func (k *KeybaseServiceBase) GetTLFCryptKeys(ctx context.Context, tlfName string) (res keybase1.TLFCryptKeys, err error)
- func (k *KeybaseServiceBase) Identify(ctx context.Context, assertion, reason string) (UserInfo, error)
- func (k *KeybaseServiceBase) KeyfamilyChanged(ctx context.Context, uid keybase1.UID) error
- func (k *KeybaseServiceBase) LoadUnverifiedKeys(ctx context.Context, uid keybase1.UID) ([]keybase1.PublicKey, error)
- func (k *KeybaseServiceBase) LoadUserPlusKeys(ctx context.Context, uid keybase1.UID) (UserInfo, error)
- func (k *KeybaseServiceBase) LoggedIn(ctx context.Context, name string) error
- func (k *KeybaseServiceBase) LoggedOut(ctx context.Context) error
- func (k *KeybaseServiceBase) Notify(ctx context.Context, notification *keybase1.FSNotification) error
- func (k *KeybaseServiceBase) PaperKeyCached(ctx context.Context, arg keybase1.PaperKeyCachedArg) error
- func (k *KeybaseServiceBase) Resolve(ctx context.Context, assertion string) (libkb.NormalizedUsername, keybase1.UID, error)
- type KeybaseServiceCn
- type KeybaseServiceMeasured
- func (k KeybaseServiceMeasured) CurrentSession(ctx context.Context, sessionID int) (sessionInfo SessionInfo, err error)
- func (k KeybaseServiceMeasured) FavoriteAdd(ctx context.Context, folder keybase1.Folder) (err error)
- func (k KeybaseServiceMeasured) FavoriteDelete(ctx context.Context, folder keybase1.Folder) (err error)
- func (k KeybaseServiceMeasured) FavoriteList(ctx context.Context, sessionID int) (favorites []keybase1.Folder, err error)
- func (k KeybaseServiceMeasured) FlushUserFromLocalCache(ctx context.Context, uid keybase1.UID)
- func (k KeybaseServiceMeasured) FlushUserUnverifiedKeysFromLocalCache(ctx context.Context, uid keybase1.UID)
- func (k KeybaseServiceMeasured) Identify(ctx context.Context, assertion, reason string) (userInfo UserInfo, err error)
- func (k KeybaseServiceMeasured) LoadUnverifiedKeys(ctx context.Context, uid keybase1.UID) (keys []keybase1.PublicKey, err error)
- func (k KeybaseServiceMeasured) LoadUserPlusKeys(ctx context.Context, uid keybase1.UID) (userInfo UserInfo, err error)
- func (k KeybaseServiceMeasured) Notify(ctx context.Context, notification *keybase1.FSNotification) (err error)
- func (k KeybaseServiceMeasured) Resolve(ctx context.Context, assertion string) (name libkb.NormalizedUsername, uid keybase1.UID, err error)
- func (k KeybaseServiceMeasured) Shutdown()
- type LocalUser
- type MDCache
- type MDCacheStandard
- type MDDiskUsageMismatch
- type MDJournalConflictError
- type MDMismatchError
- type MDMissingDataError
- type MDOps
- type MDOpsStandard
- func (md *MDOpsStandard) GetForHandle(ctx context.Context, handle *TlfHandle, mStatus MergeStatus) (TlfID, ImmutableRootMetadata, error)
- func (md *MDOpsStandard) GetForTLF(ctx context.Context, id TlfID) (ImmutableRootMetadata, error)
- func (md *MDOpsStandard) GetLatestHandleForTLF(ctx context.Context, id TlfID) (BareTlfHandle, error)
- func (md *MDOpsStandard) GetRange(ctx context.Context, id TlfID, start, stop MetadataRevision) ([]ImmutableRootMetadata, error)
- func (md *MDOpsStandard) GetUnmergedForTLF(ctx context.Context, id TlfID, bid BranchID) (ImmutableRootMetadata, error)
- func (md *MDOpsStandard) GetUnmergedRange(ctx context.Context, id TlfID, bid BranchID, start, stop MetadataRevision) ([]ImmutableRootMetadata, error)
- func (md *MDOpsStandard) PruneBranch(ctx context.Context, id TlfID, bid BranchID) error
- func (md *MDOpsStandard) Put(ctx context.Context, rmd *RootMetadata) (MdID, error)
- func (md *MDOpsStandard) PutUnmerged(ctx context.Context, rmd *RootMetadata) (MdID, error)
- type MDPrevRootMismatch
- type MDRevisionMismatch
- type MDServer
- type MDServerDisconnected
- type MDServerDisk
- func (md *MDServerDisk) CheckForRekeys(ctx context.Context) <-chan error
- func (md *MDServerDisk) DisableRekeyUpdatesForTesting()
- func (md *MDServerDisk) GetForHandle(ctx context.Context, handle BareTlfHandle, mStatus MergeStatus) (TlfID, *RootMetadataSigned, error)
- func (md *MDServerDisk) GetForTLF(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
- func (md *MDServerDisk) GetLatestHandleForTLF(_ context.Context, id TlfID) (BareTlfHandle, error)
- func (md *MDServerDisk) GetRange(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus, ...) ([]*RootMetadataSigned, error)
- func (md *MDServerDisk) IsConnected() bool
- func (md *MDServerDisk) OffsetFromServerTime() (time.Duration, bool)
- func (md *MDServerDisk) PruneBranch(ctx context.Context, id TlfID, bid BranchID) error
- func (md *MDServerDisk) Put(ctx context.Context, rmds *RootMetadataSigned) error
- func (md *MDServerDisk) RefreshAuthToken(ctx context.Context)
- func (md *MDServerDisk) RegisterForUpdate(ctx context.Context, id TlfID, currHead MetadataRevision) (<-chan error, error)
- func (md *MDServerDisk) Shutdown()
- func (md *MDServerDisk) TruncateLock(ctx context.Context, id TlfID) (bool, error)
- func (md *MDServerDisk) TruncateUnlock(ctx context.Context, id TlfID) (bool, error)
- type MDServerError
- type MDServerErrorBadRequest
- type MDServerErrorConditionFailed
- type MDServerErrorConflictDiskUsage
- type MDServerErrorConflictFolderMapping
- type MDServerErrorConflictPrevRoot
- type MDServerErrorConflictRevision
- type MDServerErrorLocked
- type MDServerErrorThrottle
- type MDServerErrorUnauthorized
- type MDServerErrorUnwrapper
- type MDServerErrorWriteAccess
- type MDServerMemory
- func (md *MDServerMemory) CheckForRekeys(ctx context.Context) <-chan error
- func (md *MDServerMemory) DisableRekeyUpdatesForTesting()
- func (md *MDServerMemory) GetForHandle(ctx context.Context, handle BareTlfHandle, mStatus MergeStatus) (TlfID, *RootMetadataSigned, error)
- func (md *MDServerMemory) GetForTLF(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
- func (md *MDServerMemory) GetLatestHandleForTLF(_ context.Context, id TlfID) (BareTlfHandle, error)
- func (md *MDServerMemory) GetRange(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus, ...) ([]*RootMetadataSigned, error)
- func (md *MDServerMemory) IsConnected() bool
- func (md *MDServerMemory) OffsetFromServerTime() (time.Duration, bool)
- func (md *MDServerMemory) PruneBranch(ctx context.Context, id TlfID, bid BranchID) error
- func (md *MDServerMemory) Put(ctx context.Context, rmds *RootMetadataSigned) error
- func (md *MDServerMemory) RefreshAuthToken(ctx context.Context)
- func (md *MDServerMemory) RegisterForUpdate(ctx context.Context, id TlfID, currHead MetadataRevision) (<-chan error, error)
- func (md *MDServerMemory) Shutdown()
- func (md *MDServerMemory) TruncateLock(ctx context.Context, id TlfID) (bool, error)
- func (md *MDServerMemory) TruncateUnlock(ctx context.Context, id TlfID) (bool, error)
- type MDServerRemote
- func (md *MDServerRemote) CheckForRekeys(ctx context.Context) <-chan error
- func (md *MDServerRemote) DeleteTLFCryptKeyServerHalf(ctx context.Context, uid keybase1.UID, kid keybase1.KID, ...) error
- func (md *MDServerRemote) DisableRekeyUpdatesForTesting()
- func (md *MDServerRemote) FolderNeedsRekey(_ context.Context, arg keybase1.FolderNeedsRekeyArg) error
- func (md *MDServerRemote) GetForHandle(ctx context.Context, handle BareTlfHandle, mStatus MergeStatus) (TlfID, *RootMetadataSigned, error)
- func (md *MDServerRemote) GetForTLF(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
- func (md *MDServerRemote) GetLatestHandleForTLF(ctx context.Context, id TlfID) (BareTlfHandle, error)
- func (md *MDServerRemote) GetRange(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus, ...) ([]*RootMetadataSigned, error)
- func (md *MDServerRemote) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, ...) (serverHalf TLFCryptKeyServerHalf, err error)
- func (*MDServerRemote) HandlerName() string
- func (md *MDServerRemote) IsConnected() bool
- func (md *MDServerRemote) MetadataUpdate(_ context.Context, arg keybase1.MetadataUpdateArg) error
- func (md *MDServerRemote) OffsetFromServerTime() (time.Duration, bool)
- func (md *MDServerRemote) OnConnect(ctx context.Context, conn *rpc.Connection, client rpc.GenericClient, ...) (err error)
- func (md *MDServerRemote) OnConnectError(err error, wait time.Duration)
- func (md *MDServerRemote) OnDisconnected(ctx context.Context, status rpc.DisconnectStatus)
- func (md *MDServerRemote) OnDoCommandError(err error, wait time.Duration)
- func (md *MDServerRemote) PruneBranch(ctx context.Context, id TlfID, bid BranchID) error
- func (md *MDServerRemote) Put(ctx context.Context, rmds *RootMetadataSigned) error
- func (md *MDServerRemote) PutTLFCryptKeyServerHalves(ctx context.Context, ...) error
- func (md *MDServerRemote) RefreshAuthToken(ctx context.Context)
- func (md *MDServerRemote) RegisterForUpdate(ctx context.Context, id TlfID, currHead MetadataRevision) (<-chan error, error)
- func (md *MDServerRemote) RemoteAddress() string
- func (md *MDServerRemote) ShouldRetry(name string, err error) bool
- func (md *MDServerRemote) ShouldRetryOnConnect(err error) bool
- func (md *MDServerRemote) Shutdown()
- func (md *MDServerRemote) TruncateLock(ctx context.Context, id TlfID) (bool, error)
- func (md *MDServerRemote) TruncateUnlock(ctx context.Context, id TlfID) (bool, error)
- type MDTlfIDMismatch
- type MDUpdateInvertError
- type MDWriteNeededInRequest
- type MdID
- type MergeStatus
- type MerkleHash
- type MerkleLeaf
- type MerkleRoot
- type MetadataFlags
- type MetadataIsFinalError
- type MetadataRevision
- type MetadataVer
- type MutableBareRootMetadata
- type MutableBareRootMetadataNoImplError
- type NameExistsError
- type NameTooLongError
- type NaïveStaller
- func (s *NaïveStaller) StallBlockOp(stalledOp StallableBlockOp)
- func (s *NaïveStaller) StallMDOp(stalledOp StallableMDOp)
- func (s *NaïveStaller) UndoStallBlockOp(stalledOp StallableBlockOp)
- func (s *NaïveStaller) UndoStallMDOp(stalledOp StallableMDOp)
- func (s *NaïveStaller) UnstallOneBlockOp(stalledOp StallableBlockOp)
- func (s *NaïveStaller) UnstallOneMDOp(stalledOp StallableMDOp)
- func (s *NaïveStaller) WaitForStallBlockOp(stalledOp StallableBlockOp)
- func (s *NaïveStaller) WaitForStallMDOp(stalledOp StallableMDOp)
- type NeedOtherRekeyError
- type NeedSelfRekeyError
- type NewDataVersionError
- type NewKeyGenerationError
- type NewMetadataVersionError
- type NoChainFoundError
- type NoCurrentSessionError
- type NoKeysError
- type NoSigChainError
- type NoSuchBlockError
- type NoSuchFolderListError
- type NoSuchMDError
- type NoSuchNameError
- type NoSuchTlfHandleError
- type NoSuchUserError
- type Node
- type NodeCache
- type NodeChange
- type NodeID
- type NodeNotFoundError
- type NotDirBlockError
- type NotDirError
- type NotDirectFileBlockError
- type NotFileBlockError
- type NotFileError
- type NotPermittedWhileDirtyError
- type Notifier
- type Observer
- type OpCommon
- func (oc *OpCommon) AddRefBlock(ptr BlockPointer)
- func (oc *OpCommon) AddUnrefBlock(ptr BlockPointer)
- func (oc *OpCommon) AddUpdate(oldPtr BlockPointer, newPtr BlockPointer)
- func (oc *OpCommon) DelRefBlock(ptr BlockPointer)
- func (oc *OpCommon) Refs() []BlockPointer
- func (oc *OpCommon) Unrefs() []BlockPointer
- type OpSummary
- type OpsCantHandleFavorite
- type OutdatedVersionError
- type OverQuotaWarning
- type PaddedBlockReadError
- type ParentNodeNotFoundError
- type PrivateMetadata
- type RawDefaultHash
- type ReadAccessError
- type ReadOnlyRootMetadata
- type ReadyBlockData
- type RekeyConflictError
- type RekeyIncompleteError
- type RekeyPermissionError
- type RekeyQueue
- type RekeyQueueStandard
- type RenameAcrossDirsError
- type RepeatedWaitGroup
- type ReportedError
- type Reporter
- type ReporterKBPKI
- type ReporterSimple
- type RootMetadata
- func (md *RootMetadata) AddDiskUsage(diskUsage uint64)
- func (md *RootMetadata) AddNewKeys(wkb TLFWriterKeyBundle, rkb TLFReaderKeyBundle) error
- func (md *RootMetadata) AddOp(o op)
- func (md *RootMetadata) AddRefBlock(info BlockInfo)
- func (md *RootMetadata) AddRefBytes(refBytes uint64)
- func (md *RootMetadata) AddUnrefBlock(info BlockInfo)
- func (md *RootMetadata) AddUnrefBytes(unrefBytes uint64)
- func (md *RootMetadata) AddUpdate(oldInfo BlockInfo, newInfo BlockInfo)
- func (md *RootMetadata) BID() BranchID
- func (md *RootMetadata) ClearBlockChanges()
- func (md *RootMetadata) Data() *PrivateMetadata
- func (md *RootMetadata) DiskUsage() uint64
- func (md *RootMetadata) FakeInitialRekey(h BareTlfHandle)
- func (md *RootMetadata) GetBareRootMetadata() BareRootMetadata
- func (md *RootMetadata) GetSerializedPrivateMetadata() []byte
- func (md *RootMetadata) GetSerializedWriterMetadata(codec Codec) ([]byte, error)
- func (md *RootMetadata) GetTLFCryptKeyParams(keyGen KeyGen, user keybase1.UID, key CryptPublicKey) (TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, TLFCryptKeyServerHalfID, ...)
- func (md *RootMetadata) GetTlfHandle() *TlfHandle
- func (md *RootMetadata) GetWriterMetadataSigInfo() SignatureInfo
- func (md *RootMetadata) HasKeyForUser(keyGen KeyGen, user keybase1.UID) bool
- func (md *RootMetadata) IsFinal() bool
- func (md *RootMetadata) IsInitialized() bool
- func (md *RootMetadata) IsReadable() bool
- func (md *RootMetadata) IsRekeySet() bool
- func (md *RootMetadata) IsUnmergedSet() bool
- func (md *RootMetadata) IsWriterMetadataCopiedSet() bool
- func (md *RootMetadata) LastModifyingUser() keybase1.UID
- func (md *RootMetadata) LastModifyingWriter() keybase1.UID
- func (md *RootMetadata) LastModifyingWriterKID() keybase1.KID
- func (md *RootMetadata) LatestKeyGeneration() KeyGen
- func (md *RootMetadata) MakeBareTlfHandle() (BareTlfHandle, error)
- func (md *RootMetadata) MakeSuccessor(config Config, mdID MdID, isWriter bool) (*RootMetadata, error)
- func (md *RootMetadata) MergedStatus() MergeStatus
- func (md *RootMetadata) PrevRoot() MdID
- func (md *RootMetadata) ReadOnly() ReadOnlyRootMetadata
- func (md *RootMetadata) RefBytes() uint64
- func (md *RootMetadata) Revision() MetadataRevision
- func (md *RootMetadata) SetBranchID(bid BranchID)
- func (md *RootMetadata) SetConflictInfo(ci *TlfHandleExtension)
- func (md *RootMetadata) SetDiskUsage(diskUsage uint64)
- func (md *RootMetadata) SetFinalBit()
- func (md *RootMetadata) SetFinalizedInfo(fi *TlfHandleExtension)
- func (md *RootMetadata) SetLastModifyingUser(user keybase1.UID)
- func (md *RootMetadata) SetLastModifyingWriter(user keybase1.UID)
- func (md *RootMetadata) SetPrevRoot(mdID MdID)
- func (md *RootMetadata) SetRefBytes(refBytes uint64)
- func (md *RootMetadata) SetRekeyBit()
- func (md *RootMetadata) SetRevision(revision MetadataRevision)
- func (md *RootMetadata) SetSerializedPrivateMetadata(spmd []byte)
- func (md *RootMetadata) SetTlfID(tlf TlfID)
- func (md *RootMetadata) SetUnmerged()
- func (md *RootMetadata) SetUnrefBytes(unrefBytes uint64)
- func (md *RootMetadata) SetUnresolvedReaders(readers []keybase1.SocialAssertion)
- func (md *RootMetadata) SetUnresolvedWriters(writers []keybase1.SocialAssertion)
- func (md *RootMetadata) SetWriterMetadataCopiedBit()
- func (md *RootMetadata) SetWriterMetadataSigInfo(sigInfo SignatureInfo)
- func (md *RootMetadata) SetWriters(writers []keybase1.UID)
- func (md *RootMetadata) TlfID() TlfID
- func (md *RootMetadata) UnrefBytes() uint64
- func (md *RootMetadata) Update(id TlfID, h BareTlfHandle) error
- type RootMetadataSigned
- func (rmds *RootMetadataSigned) IsLastModifiedBy(uid keybase1.UID, key VerifyingKey) error
- func (rmds *RootMetadataSigned) IsValidAndSigned(codec Codec, crypto cryptoPure) error
- func (rmds *RootMetadataSigned) MakeFinalCopy(config Config) (*RootMetadataSigned, error)
- func (rmds *RootMetadataSigned) MerkleHash(config Config) (MerkleHash, error)
- func (rmds *RootMetadataSigned) Version() MetadataVer
- type SessionInfo
- type SharedKeybaseTransport
- type ShutdownHappenedError
- type SigVer
- type SignatureInfo
- type SigningKey
- type SigningKeySecret
- type SizeFlag
- type StallableBlockOp
- type StallableMDOp
- type StateChecker
- type StatusUpdate
- type TLFCryptKey
- type TLFCryptKeyClientHalf
- type TLFCryptKeyInfo
- type TLFCryptKeyServerHalf
- type TLFCryptKeyServerHalfID
- type TLFEphemeralPrivateKey
- type TLFEphemeralPublicKey
- type TLFEphemeralPublicKeys
- type TLFJournalStatus
- type TLFPrivateKey
- type TLFPublicKey
- type TLFReaderKeyBundle
- type TLFReaderKeyGenerations
- type TLFUpdateHistory
- type TLFWriterKeyBundle
- type TLFWriterKeyGenerations
- type TestClock
- type TestDynamoDBRunner
- type TimeoutError
- type TlfAccessError
- type TlfEdit
- type TlfEditHistory
- func (teh *TlfEditHistory) GetComplete(ctx context.Context, head ImmutableRootMetadata) (TlfWriterEdits, error)
- func (teh *TlfEditHistory) Shutdown()
- func (teh *TlfEditHistory) UpdateHistory(ctx context.Context, rmds []ImmutableRootMetadata) error
- func (teh *TlfEditHistory) Wait(ctx context.Context) error
- type TlfEditList
- type TlfEditNotificationType
- type TlfHandle
- func (h TlfHandle) ConflictInfo() *TlfHandleExtension
- func (h TlfHandle) Equals(codec Codec, other TlfHandle) (bool, error)
- func (h TlfHandle) EqualsIgnoreName(codec Codec, other TlfHandle) (bool, error)
- func (h TlfHandle) Extensions() (extensions []TlfHandleExtension)
- func (h TlfHandle) FinalizedInfo() *TlfHandleExtension
- func (h TlfHandle) FirstResolvedWriter() keybase1.UID
- func (h *TlfHandle) GetCanonicalName() CanonicalTlfName
- func (h *TlfHandle) GetCanonicalPath() string
- func (h TlfHandle) IsConflict() bool
- func (h TlfHandle) IsFinal() bool
- func (h TlfHandle) IsPublic() bool
- func (h TlfHandle) IsReader(user keybase1.UID) bool
- func (h TlfHandle) IsWriter(user keybase1.UID) bool
- func (h *TlfHandle) ResolveAgain(ctx context.Context, resolver resolver) (*TlfHandle, error)
- func (h *TlfHandle) ResolveAgainForUser(ctx context.Context, resolver resolver, uid keybase1.UID) (*TlfHandle, error)
- func (h TlfHandle) ResolvedReaders() []keybase1.UID
- func (h TlfHandle) ResolvedWriters() []keybase1.UID
- func (h TlfHandle) ResolvesTo(ctx context.Context, codec Codec, resolver resolver, other TlfHandle) (resolvesTo bool, partialResolvedH *TlfHandle, err error)
- func (h *TlfHandle) SetFinalizedInfo(info *TlfHandleExtension)
- func (h TlfHandle) ToBareHandle() (BareTlfHandle, error)
- func (h TlfHandle) ToBareHandleOrBust() BareTlfHandle
- func (h *TlfHandle) ToFavorite() Favorite
- func (h TlfHandle) UnresolvedReaders() []keybase1.SocialAssertion
- func (h TlfHandle) UnresolvedWriters() []keybase1.SocialAssertion
- func (h *TlfHandle) UpdateConflictInfo(codec Codec, info *TlfHandleExtension) error
- type TlfHandleExtension
- func NewTestTlfHandleExtensionStaticTime(extType TlfHandleExtensionType, num uint16, un libkb.NormalizedUsername) (*TlfHandleExtension, error)
- func NewTestTlfHandleExtensionWithClock(extType TlfHandleExtensionType, num uint16, un libkb.NormalizedUsername, ...) (*TlfHandleExtension, error)
- func NewTlfHandleExtension(extType TlfHandleExtensionType, num uint16, un libkb.NormalizedUsername) (*TlfHandleExtension, error)
- func ParseTlfHandleExtensionSuffix(s string) ([]TlfHandleExtension, error)
- type TlfHandleExtensionMismatchError
- type TlfHandleExtensionType
- type TlfHandleFinalizedError
- type TlfID
- type TlfNameNotCanonical
- type TlfWriterEdits
- type TooLowByteCountError
- type UnexpectedShortCryptoRandRead
- type UnexpectedUnmergedPutError
- type UnknownEncryptionVer
- type UnknownHashTypeError
- type UnknownSigVer
- type UnmergedError
- type UnmergedSelfConflictError
- type UnverifiableTlfUpdateError
- type UpdateSummary
- type UsageStat
- type UsageType
- type UserDeviceKeyInfoMap
- type UserInfo
- type UserQuotaInfo
- type VerifyingKey
- type WrapError
- type WriteAccessError
- type WriteRange
- type WriterDeviceDateConflictRenamer
- type WriterFlags
- type WriterMetadataExtra
- type WriterMetadataV2
- type WrongOpsError
Constants ¶
const ( // BranchIDByteLen is the number of bytes in a per-device per-TLF branch ID. BranchIDByteLen = 16 // BranchIDStringLen is the number of characters in the string // representation of a per-device per-TLF branch ID. BranchIDStringLen = 2 * BranchIDByteLen )
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 ( // BServerTokenServer is the expected server type for bserver authentication. BServerTokenServer = "kbfs_block" // BServerTokenExpireIn is the TTL to use when constructing an authentication token. BServerTokenExpireIn = 2 * 60 * 60 // 2 hours )
const ( KeybaseServiceName = "keybase-service" MDServiceName = "md-server" )
Service names used in ConnectionStatus.
const ( // ReaderSep is the string that separates readers from writers in a // TLF name. ReaderSep = "#" // TlfHandleExtensionSep is the string that separates the folder // participants from an extension suffix in the TLF name. TlfHandleExtensionSep = " " // PublicUIDName is the name given to keybase1.PublicUID. This string // should correspond to an illegal or reserved Keybase user name. PublicUIDName = "_public" )
const ( // FirstValidMetadataVer is the first value that is considered a // valid data version. For historical reasons 0 is considered // valid. FirstValidMetadataVer = 0 // PreExtraMetadataVer is the latest metadata version that did not include // support for extra MD fields. PreExtraMetadataVer = 1 // InitialExtraMetadataVer is the first metadata version that did // include support for extra MD fields. InitialExtraMetadataVer = 2 )
const ( // FirstValidDataVer is the first value that is considered a // valid data version. Note that the nil value is not // considered valid. FirstValidDataVer = 1 // FilesWithHolesDataVer is the data version for files // with holes. FilesWithHolesDataVer = 2 )
const ( // MinHashByteLength is the minimum number of bytes a valid // keybase hash can be, including the 1 byte for the type. MinHashByteLength = 33 // DefaultHashByteLength is the number of bytes in a default // keybase hash. DefaultHashByteLength = 1 + sha256.Size // MaxHashByteLength is the maximum number of bytes a valid // keybase hash can be, including the 1 byte for the type. MaxHashByteLength = 129 // MinHashStringLength is the minimum number of characters in // the string representation (hex encoding) of a valid keybase // hash. MinHashStringLength = 2 * MinHashByteLength // DefaultHashStringLength is the number of characters in the // string representation of a default keybase hash. DefaultHashStringLength = 2 * DefaultHashByteLength // MaxHashStringLength is the maximum number of characters the // string representation of a valid keybase hash can be. MaxHashStringLength = 2 * MaxHashByteLength )
const ( // StatusCodeMDServerError is the error code for a generic server error. StatusCodeMDServerError = 2800 // StatusCodeMDServerErrorBadRequest is the error code for a generic client error. StatusCodeMDServerErrorBadRequest = 2801 // StatusCodeMDServerErrorConflictRevision is the error code for a revision conflict error. StatusCodeMDServerErrorConflictRevision = 2802 // StatusCodeMDServerErrorConflictPrevRoot is the error code for a PrevRoot pointer conflict error. StatusCodeMDServerErrorConflictPrevRoot = 2803 // StatusCodeMDServerErrorConflictDiskUsage is the error code for a disk usage conflict error. StatusCodeMDServerErrorConflictDiskUsage = 2804 // StatusCodeMDServerErrorLocked is the error code to indicate the folder truncation lock is locked. StatusCodeMDServerErrorLocked = 2805 // a certain operation. This is also used to indicate an object isn't found. StatusCodeMDServerErrorUnauthorized = 2806 // StatusCodeMDServerErrorThrottle is the error code to indicate the client should initiate backoff. StatusCodeMDServerErrorThrottle = 2807 // StatusCodeMDServerErrorConditionFailed is the error code to indicate the write condition failed. StatusCodeMDServerErrorConditionFailed = 2808 // StatusCodeMDServerErrorWriteAccess is the error code to indicate the client isn't authorized to // write to a TLF. StatusCodeMDServerErrorWriteAccess = 2809 // StatusCodeMDServerErrorConflictFolderMapping is the error code for a folder handle to folder ID // mapping conflict error. StatusCodeMDServerErrorConflictFolderMapping = 2810 )
const ( // MdServerTokenServer is the expected server type for mdserver authentication. MdServerTokenServer = "kbfs_md" // MdServerTokenExpireIn is the TTL to use when constructing an authentication token. MdServerTokenExpireIn = 2 * 60 * 60 // 2 hours // MdServerBackgroundRekeyPeriod is how long the rekey checker // waits between runs. The timer gets reset to this period after // every incoming FolderNeedsRekey RPC. MdServerBackgroundRekeyPeriod = 1 * time.Hour // MdServerDefaultPingIntervalSeconds is the default interval on which the // client should contact the MD Server MdServerDefaultPingIntervalSeconds = 10 )
const ( // MetadataRevisionUninitialized indicates that a top-level folder has // not yet been initialized. MetadataRevisionUninitialized = MetadataRevision(0) // MetadataRevisionInitial is always the first revision for an // initialized top-level folder. MetadataRevisionInitial = MetadataRevision(1) )
const ( // EnvTestMDServerAddr is the environment variable name for an // mdserver address. EnvTestMDServerAddr = "KEYBASE_TEST_MDSERVER_ADDR" // EnvTestBServerAddr is the environment variable name for a block // server address. EnvTestBServerAddr = "KEYBASE_TEST_BSERVER_ADDR" // TempdirServerAddr is the special value of the // EnvTest{B,MD}ServerAddr environment value to signify that // an on-disk implementation of the {b,md}server should be // used with a temporary directory. TempdirServerAddr = "tempdir" )
const ( // LocalDynamoDBDownloadURI source: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html // We don't use latest because Amazon doesn't offer https downloads of this. So we peg to a revision and verify the hash. LocalDynamoDBDownloadURI = "http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_2016-04-19.tar.gz" // LocalDynamoDBSha256Hash is the sha256 hash of the above tar ball. LocalDynamoDBSha256Hash = "35bcbf97c1c3ef8607ac0032d6127eae313edd26a73c80fdc230e4d8a14c1c33" // LocalDynamoDBTmpDir is relative to the system's own TempDir. LocalDynamoDBTmpDir = "dynamodb_local" // LocalDynamoDBPidFile contains the process ID. LocalDynamoDBPidFile = "dynamodb.pid" // LocalDynamoDBJarFile is the name of the local dynamodb server jar file. LocalDynamoDBJarFile = "DynamoDBLocal.jar" // LocalDynamoDBUri is the default local dynamodb URI. LocalDynamoDBUri = "http://127.0.0.1:8000" )
const ( StallableBlockGet StallableBlockOp = "Get" StallableBlockReady StallableBlockOp = "Ready" StallableBlockPut StallableBlockOp = "Put" StallableBlockDelete StallableBlockOp = "Delete" StallableBlockArchive StallableBlockOp = "Archive" StallableMDGetForHandle StallableMDOp = "GetForHandle" StallableMDGetForTLF StallableMDOp = "GetForTLF" StallableMDGetLatestHandleForTLF StallableMDOp = "GetLatestHandleForTLF" StallableMDGetUnmergedForTLF StallableMDOp = "GetUnmergedForTLF" StallableMDGetRange StallableMDOp = "GetRange" StallableMDGetUnmergedRange StallableMDOp = "GetUnmergedRange" StallableMDPut StallableMDOp = "Put" StallableMDAfterPut StallableMDOp = "AfterPut" StallableMDPutUnmerged StallableMDOp = "PutUnmerged" StallableMDAfterPutUnmerged StallableMDOp = "AfterPutUnmerged" StallableMDPruneBranch StallableMDOp = "PruneBranch" )
stallable Block Ops and MD Ops
const ( // TlfHandleExtensionDateFormat is the date format for the TlfHandleExtension string. TlfHandleExtensionDateFormat = "2006-01-02" // TlfHandleExtensionDateRegex is the regular expression matching the TlfHandleExtension // date member in string form. TlfHandleExtensionDateRegex = "2[0-9]{3}-[0-9]{2}-[0-9]{2}" // TlfHandleExtensionNumberRegex is the regular expression matching the TlfHandleExtension // number member in string form. TlfHandleExtensionNumberRegex = "[0-9]+" // TlfHandleExtensionUsernameRegex is the regular expression matching the TlfHandleExtension // username member in string form. TlfHandleExtensionUsernameRegex = "[a-z0-9_]+" // TlfHandleExtensionConflictString is the string identifying a conflict extension. TlfHandleExtensionConflictString = "conflicted copy" // TlfHandleExtensionFinalizedString is the format string identifying a finalized extension. TlfHandleExtensionFinalizedString = "files before %saccount reset" // TlfHandleExtensionFormat is the formate string for a TlfHandleExtension. TlfHandleExtensionFormat = "(%s %s%s)" // TlfHandleExtensionStaticTestDate is a static date used for tests (2016-03-14). TlfHandleExtensionStaticTestDate = 1457913600 )
const ( // TlfIDByteLen is the number of bytes in a top-level folder ID TlfIDByteLen = 16 // TlfIDStringLen is the number of characters in the string // representation of a top-level folder ID TlfIDStringLen = 2 * TlfIDByteLen // TlfIDSuffix is the last byte of a private top-level folder ID TlfIDSuffix = 0x16 // PubTlfIDSuffix is the last byte of a public top-level folder ID PubTlfIDSuffix = 0x17 )
const AuthTokenMinRefreshSeconds = 60
AuthTokenMinRefreshSeconds is the minimum number of seconds between refreshes.
const CryptPrivateKeySecretSize = libkb.NaclDHKeySecretSize
CryptPrivateKeySecretSize is the size of a CryptPrivateKeySecret.
const ( // CtxBackgroundSyncKey is set in the context for any change // notifications that are triggered from a background sync. // Observers can ignore these if they want, since they will have // already gotten the relevant notifications via LocalChanges. CtxBackgroundSyncKey = "kbfs-background" )
const CtxCROpID = "CRID"
CtxCROpID is the display name for the unique operation conflict resolution ID tag.
const CtxFBMOpID = "FBMID"
CtxFBMOpID is the display name for the unique operation folderBlockManager ID tag.
const CtxFBOOpID = "FBOID"
CtxFBOOpID is the display name for the unique operation folderBranchOps ID tag.
const CtxKeybaseServiceOpID = "KSID"
CtxKeybaseServiceOpID is the display name for the unique operation enqueued rekey ID tag.
const CtxMDSROpID = "MDSRID"
CtxMDSROpID is the display name for the unique operation MDServerRemote ID tag.
const CtxRekeyOpID = "REKEYID"
CtxRekeyOpID is the display name for the unique operation enqueued rekey ID tag.
const DevRootCerts = `` /* 4438-byte string literal not displayed */
DevRootCerts are the root CA certificates for the dev VPC. During rotation multiple certificates are expected in the PEM blob.
const ( // EnvTestRootCertPEM is the environment variable name for the // CA cert PEM the client uses to verify the KBFS servers when // testing. Any certificate present here overrides any // certificate inferred from a server address. EnvTestRootCertPEM = "KEYBASE_TEST_ROOT_CERT_PEM" )
const MaxBlockIDStringLength = MaxHashStringLength
MaxBlockIDStringLength is the maximum length of the string representation of a BlockID.
const ( // MaxBlockSizeBytesDefault is the default maximum block size for KBFS. // 512K blocks by default, block changes embedded max == 8K. // Block size was chosen somewhat arbitrarily by trying to // minimize the overall size of the history written by a user when // appending 1KB writes to a file, up to a 1GB total file. Here // is the output of a simple script that approximates that // calculation: // // Total history size for 0065536-byte blocks: 1134341128192 bytes // Total history size for 0131072-byte blocks: 618945052672 bytes // Total history size for 0262144-byte blocks: 412786622464 bytes // Total history size for 0524288-byte blocks: 412786622464 bytes // Total history size for 1048576-byte blocks: 618945052672 bytes // Total history size for 2097152-byte blocks: 1134341128192 bytes // Total history size for 4194304-byte blocks: 2216672886784 bytes MaxBlockSizeBytesDefault = 512 << 10 )
Constants used in this file. TODO: Make these configurable?
const MerkleRootVersion = 1
MerkleRootVersion is the current Merkle root version.
const ProductionRootCerts = `` /* 4451-byte string literal not displayed */
ProductionRootCerts are the root CA certificates for the production VPC. During rotation multiple certificates are expected in the PEM blob.
const SigningKeySecretSize = libkb.NaclSigningKeySecretSize
SigningKeySecretSize is the size of a SigningKeySecret.
const TestRootCert = `` /* 4195-byte string literal not displayed */
TestRootCert is a CA cert which can be used for testing TLS support. 127.0.0.1 is the only supported address.
const TestRootKey = `` /* 1678-byte string literal not displayed */
TestRootKey can be used with the above cert+public key to test TLS support.
const Version = "1.0.2"
Version is the current version (should be MAJOR.MINOR.PATCH)
Variables ¶
var DefaultHashNew = sha256.New
DefaultHashNew is a function that creates a new hash.Hash object with the default hash.
var ErrInvalidReader = errors.New("Cannot make TLF handle with invalid reader")
ErrInvalidReader is the error returned by MakeBareTlfHandle if it is passed an invalid reader.
var ErrInvalidWriter = errors.New("Cannot make TLF handle with invalid writer")
ErrInvalidWriter is the error returned by MakeBareTlfHandle if it is passed an invalid writer.
var ErrNoWriters = errors.New("Cannot make TLF handle with no writers; need rekey?")
ErrNoWriters is the error returned by MakeBareTlfHandle if it is passed an empty list of writers.
var ErrTlfHandleExtensionInvalidNumber = errors.New("Invalid TLF handle extension number")
ErrTlfHandleExtensionInvalidNumber is returned when an invalid number is used in an extension definition. Handle extension numbers present in the string must be >1. Numbers passed to NewTlfHandleExtension must be >0.
var ErrTlfHandleExtensionInvalidString = errors.New("Invalid TLF handle extension string")
ErrTlfHandleExtensionInvalidString is returned when a given string is not parsable as a valid extension suffix.
var ErrorFile = ".kbfs_error"
ErrorFile is the name of the virtual file in KBFS that should contain the last reported error(s).
var NoCurrentSessionExpectedError = "no current session"
NoCurrentSessionExpectedError is the error text that will get converted into a NoCurrentSessionError.
var NullBranchID = BranchID{}
NullBranchID is an empty BranchID
var NullTlfID = TlfID{}
NullTlfID is an empty TlfID
var PrereleaseBuild string
PrereleaseBuild is set at compile time for prerelease builds
var PublicTLFCryptKey = MakeTLFCryptKey([32]byte{
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
})
PublicTLFCryptKey is the TLFCryptKey used for all public TLFs. That means that anyone with just the block key for a public TLF can decrypt that block. This is not the zero TLFCryptKey so that we can distinguish it from an (erroneously?) unset TLFCryptKey.
var TlfHandleExtensionFinalizedRegex = regexp.MustCompile( fmt.Sprintf(TlfHandleExtensionFinalizedString, "(?:("+TlfHandleExtensionUsernameRegex+")[\\s]+)*"), )
TlfHandleExtensionFinalizedRegex is the compiled regular expression matching a finalized handle extension.
var TlfHandleExtensionFinalizedStringRegex = fmt.Sprintf( TlfHandleExtensionFinalizedString, "(?:"+TlfHandleExtensionUsernameRegex+"[\\s]+)*", )
TlfHandleExtensionFinalizedStringRegex is the regex identifying a finalized extension string.
var TlfHandleExtensionRegex = regexp.MustCompile( fmt.Sprintf("\\"+TlfHandleExtensionFormat, "("+TlfHandleExtensionTypeRegex+")", "("+TlfHandleExtensionDateRegex+")", "(?: #("+TlfHandleExtensionNumberRegex+"))?\\"), )
TlfHandleExtensionRegex is the compiled regular expression matching a valid combination of TLF handle extensions in string form.
var TlfHandleExtensionTypeRegex = TlfHandleExtensionConflictString + "|" + TlfHandleExtensionFinalizedStringRegex
TlfHandleExtensionTypeRegex is the regular expression matching the TlfHandleExtension string.
Functions ¶
func AddDeviceForLocalUserOrBust ¶
AddDeviceForLocalUserOrBust creates a new device for a user and returns the index for that device.
func AddNewAssertionForTest ¶
AddNewAssertionForTest makes newAssertion, which should be a single assertion that doesn't already resolve to anything, resolve to the same UID as oldAssertion, which should be an arbitrary assertion that does already resolve to something. It only applies to the given config.
func AddNewAssertionForTestOrBust ¶
func AddNewAssertionForTestOrBust(t logger.TestLogBackend, config Config, oldAssertion, newAssertion string)
AddNewAssertionForTestOrBust is like AddNewAssertionForTest, but dies if there's an error.
func AddNewKeysOrBust ¶
func AddNewKeysOrBust(t logger.TestLogBackend, rmd *RootMetadata, wkb TLFWriterKeyBundle, rkb TLFReaderKeyBundle)
AddNewKeysOrBust adds new keys to root metadata and blows up on error.
func BoolForString ¶
BoolForString returns false if trimmed string is "" (empty), "0", "false", or "no"
func CheckConfigAndShutdown ¶
func CheckConfigAndShutdown(t logger.TestLogBackend, config Config)
CheckConfigAndShutdown shuts down the given config, but fails the test if there's an error.
func CheckTlfHandleOffline ¶
CheckTlfHandleOffline does light checks whether a TLF handle looks ok, it avoids all network calls.
func CodecEqual ¶
CodecEqual returns whether or not the given objects serialize to the same byte string. x or y (or both) can be nil.
func CodecUpdate ¶
CodecUpdate encodes src into a byte string, and then decode it into dst.
func ConvertIdentifyError ¶
ConvertIdentifyError converts a errors during identify into KBFS errors
func DisableCRForTesting ¶
func DisableCRForTesting(config Config, folderBranch FolderBranch) error
DisableCRForTesting stops conflict resolution for the given folder. RestartCRForTesting should be called to restart it.
func DisableUpdatesForTesting ¶
func DisableUpdatesForTesting(config Config, folderBranch FolderBranch) ( chan<- struct{}, error)
DisableUpdatesForTesting stops the given folder from acting on new updates. Send a struct{}{} down the returned channel to restart notifications
func DoRawDefaultHash ¶
func DoRawDefaultHash(p []byte) (HashType, RawDefaultHash)
DoRawDefaultHash computes the default keybase hash of the given data, and returns the type and the raw hash bytes.
func ForceQuotaReclamationForTesting ¶
func ForceQuotaReclamationForTesting(config Config, folderBranch FolderBranch) error
ForceQuotaReclamationForTesting kicks off quota reclamation under the given config, for the given folder-branch.
func GetDefaultBServer ¶
GetDefaultBServer returns the default value for the -bserver flag.
func GetDefaultMDServer ¶
GetDefaultMDServer returns the default value for the -mdserver flag.
func GetRootCerts ¶
GetRootCerts returns a byte array with the appropriate root certs for the given host:port string.
func InitLog ¶
func InitLog(params InitParams, ctx Context) (logger.Logger, error)
InitLog sets up logging switching to a log file if necessary. Returns a valid logger even on error, which are non-fatal, thus errors from this function may be ignored. Possible errors are logged to the logger returned.
func LogTagsFromContext ¶
LogTagsFromContext is a wrapper around logger.LogTagsFromContext that simply casts the result to the type expected by rpc.Connection.
func LogTagsFromContextToMap ¶
LogTagsFromContextToMap parses log tags from the context into a map of strings.
func MakeRandomRequestID ¶
MakeRandomRequestID generates a random ID suitable for tagging a request in KBFS, and very likely to be universally unique.
func NewReadAccessError ¶
func NewReadAccessError(h *TlfHandle, username libkb.NormalizedUsername) error
NewReadAccessError constructs a ReadAccessError for the given directory and user.
func NewRekeyPermissionError ¶
func NewRekeyPermissionError( dir *TlfHandle, username libkb.NormalizedUsername) error
NewRekeyPermissionError constructs a RekeyPermissionError for the given directory and user.
func NewSharedKeybaseConnection ¶
func NewSharedKeybaseConnection(kbCtx Context, config Config, handler rpc.ConnectionHandler) *rpc.Connection
NewSharedKeybaseConnection returns a connection that tries to connect to the local keybase daemon.
func NewTlfHandleExtensionSuffix ¶
func NewTlfHandleExtensionSuffix(extensions []TlfHandleExtension) string
NewTlfHandleExtensionSuffix creates a suffix string given a set of extensions.
func NewWriteAccessError ¶
func NewWriteAccessError(h *TlfHandle, username libkb.NormalizedUsername) error
NewWriteAccessError constructs a WriteAccessError for the given directory and user.
func RegisterOps ¶
func RegisterOps(codec Codec)
RegisterOps registers all op types with the given codec.
func RestartCRForTesting ¶
func RestartCRForTesting(baseCtx context.Context, config Config, folderBranch FolderBranch) error
RestartCRForTesting re-enables conflict resolution for the given folder.
func RevokeDeviceForLocalUserOrBust ¶
func RevokeDeviceForLocalUserOrBust(t logger.TestLogBackend, config Config, uid keybase1.UID, index int)
RevokeDeviceForLocalUserOrBust revokes a device for a user in the given index.
func Shutdown ¶
func Shutdown()
Shutdown does any necessary shutdown tasks for libkbfs. Shutdown should be called at the end of main.
func StallBlockOp ¶
func StallBlockOp(ctx context.Context, config Config, stalledOp StallableBlockOp) ( onStalled <-chan struct{}, unstall chan<- struct{}, newCtx context.Context)
StallBlockOp sets a wrapped BlockOps in config so that the specified Op, stalledOp, is stalled. Caller should use the returned newCtx for subsequent operations for the stall to be effective. onStalled is a channel to notify the caller when the stall has happened. unstall is a channel for caller to unstall an Op.
func StallMDOp ¶
func StallMDOp(ctx context.Context, config Config, stalledOp StallableMDOp) ( onStalled <-chan struct{}, unstall chan<- struct{}, newCtx context.Context)
StallMDOp sets a wrapped MDOps in config so that the specified Op, stalledOp, is stalled. Caller should use the returned newCtx for subsequent operations for the stall to be effective. onStalled is a channel to notify the caller when the stall has happened. unstall is a channel for caller to unstall an Op.
func SwitchDeviceForLocalUserOrBust ¶
func SwitchDeviceForLocalUserOrBust(t logger.TestLogBackend, config Config, index int)
SwitchDeviceForLocalUserOrBust switches the current user's current device
Types ¶
type AuthToken ¶
type AuthToken struct {
// contains filtered or unexported fields
}
AuthToken encapsulates a timed authentication token.
func NewAuthToken ¶
func NewAuthToken(config Config, tokenType string, expireIn int, submoduleName string, rh AuthTokenRefreshHandler) *AuthToken
NewAuthToken creates a new authentication token.
func (*AuthToken) Shutdown ¶
func (a *AuthToken) Shutdown()
Shutdown is called to stop the refresh ticker.
func (*AuthToken) Sign ¶
Sign is called to create a new signed authentication token, including a challenge and username/uid/kid identifiers.
func (*AuthToken) SignUserless ¶
SignUserless signs the token without a username, UID, or challenge. This is useful for server-to-server communication where identity is established using only the KID. Assume the client and server clocks are roughly synchronized.
type AuthTokenRefreshHandler ¶
AuthTokenRefreshHandler defines a callback to be called when an auth token refresh is needed.
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 BadCryptoError ¶
type BadCryptoError struct {
ID BlockID
}
BadCryptoError indicates that KBFS performed a bad crypto operation.
func (BadCryptoError) Error ¶
func (e BadCryptoError) Error() string
Error implements the error interface for BadCryptoError
type BadCryptoMDError ¶
type BadCryptoMDError struct {
ID TlfID
}
BadCryptoMDError indicates that KBFS performed a bad crypto operation, specifically on a MD object.
func (BadCryptoMDError) Error ¶
func (e BadCryptoMDError) Error() string
Error implements the error interface for BadCryptoMDError
type BadDataError ¶
type BadDataError struct {
ID BlockID
}
BadDataError indicates that KBFS is storing corrupt data for a block.
func (BadDataError) Error ¶
func (e BadDataError) Error() string
Error implements the error interface for BadDataError
type BadMDError ¶
type BadMDError struct {
ID TlfID
}
BadMDError indicates that the system is storing corrupt MD object for the given TLF ID.
func (BadMDError) Error ¶
func (e BadMDError) Error() string
Error implements the error interface for BadMDError
type BadSplitError ¶
type BadSplitError struct {
}
BadSplitError indicates that the BlockSplitter has an error.
func (BadSplitError) Error ¶
func (e BadSplitError) Error() string
Error implements the error interface for BadSplitError
type BadTLFNameError ¶
type BadTLFNameError struct {
Name string
}
BadTLFNameError indicates a top-level folder name that has an incorrect format.
func (BadTLFNameError) Error ¶
func (e BadTLFNameError) Error() string
Error implements the error interface for BadTLFNameError.
type BareRootMetadata ¶
type BareRootMetadata interface {
// TlfID returns the ID of the TLF this BareRootMetadata is for.
TlfID() TlfID
// LatestKeyGeneration returns the most recent key generation in this
// BareRootMetadata, or PublicKeyGen if this TLF is public.
LatestKeyGeneration() KeyGen
// IsValidRekeyRequest returns true if the current block is a simple rekey wrt
// the passed block.
IsValidRekeyRequest(codec Codec, prevMd BareRootMetadata, user keybase1.UID) (
bool, error)
// MergedStatus returns the status of this update -- has it been
// merged into the main folder or not?
MergedStatus() MergeStatus
// IsRekeySet returns true if the rekey bit is set.
IsRekeySet() bool
// IsWriterMetadataCopiedSet returns true if the bit is set indicating
// the writer metadata was copied.
IsWriterMetadataCopiedSet() bool
// IsFinal returns true if this is the last metadata block for a given
// folder. This is only expected to be set for folder resets.
IsFinal() bool
// IsWriter returns whether or not the user+device is an authorized writer.
IsWriter(user keybase1.UID, deviceKID keybase1.KID) bool
// IsReader returns whether or not the user+device is an authorized reader.
IsReader(user keybase1.UID, deviceKID keybase1.KID) bool
// DeepCopy returns a deep copy of the underlying data structure.
DeepCopy(codec Codec) (BareRootMetadata, error)
// CheckValidSuccessor makes sure the given BareRootMetadata is a valid
// successor to the current one, and returns an error otherwise.
CheckValidSuccessor(currID MdID, nextMd BareRootMetadata) error
// CheckValidSuccessorForServer is like CheckValidSuccessor but with
// server-specific error messages.
CheckValidSuccessorForServer(currID MdID, nextMd BareRootMetadata) error
// MakeBareTlfHandle makes a BareTlfHandle for this
// BareRootMetadata. Should be used only by servers and MDOps.
MakeBareTlfHandle() (BareTlfHandle, error)
// TlfHandleExtensions returns a list of handle extensions associated with the TLf.
TlfHandleExtensions() (extensions []TlfHandleExtension)
// GetDeviceKIDs returns the KIDs (of CryptPublicKeys) for all known
// devices for the given user at the given key generation, if any.
// Returns an error if the TLF is public, or if the given key
// generation is invalid.
GetDeviceKIDs(keyGen KeyGen, user keybase1.UID) ([]keybase1.KID, error)
// HasKeyForUser returns whether or not the given user has keys for at
// least one device at the given key generation. Returns false if the
// TLF is public, or if the given key generation is invalid. Equivalent to:
//
// kids, err := GetDeviceKIDs(keyGen, user)
// return (err == nil) && (len(kids) > 0)
HasKeyForUser(keyGen KeyGen, user keybase1.UID) bool
// GetTLFCryptKeyParams returns all the necessary info to construct
// the TLF crypt key for the given key generation, user, and device
// (identified by its crypt public key), or false if not found. This
// returns an error if the TLF is public.
GetTLFCryptKeyParams(keyGen KeyGen, user keybase1.UID, key CryptPublicKey) (
TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf,
TLFCryptKeyServerHalfID, bool, error)
// IsValidAndSigned verifies the BareRootMetadata, checks the
// writer signature, and returns an error if a problem was
// found. This should be the first thing checked on a BRMD
// retrieved from an untrusted source, and then the signing
// user and key should be validated, either by comparing to
// the current device key (using IsLastModifiedBy), or by
// checking with KBPKI.
IsValidAndSigned(codec Codec, crypto cryptoPure) error
// IsLastModifiedBy verifies that the BareRootMetadata is
// written by the given user and device (identified by the KID
// of the device verifying key), and returns an error if not.
IsLastModifiedBy(uid keybase1.UID, key VerifyingKey) error
// LastModifyingWriter return the UID of the last user to modify the writer metadata.
LastModifyingWriter() keybase1.UID
// LastModifyingWriterKID returns the KID of the last device to modify the writer metadata.
LastModifyingWriterKID() keybase1.KID
// LastModifyingUser return the UID of the last user to modify the any of the metadata.
GetLastModifyingUser() keybase1.UID
// RefBytes returns the number of newly referenced bytes introduced by this revision of metadata.
RefBytes() uint64
// UnrefBytes returns the number of newly unreferenced bytes introduced by this revision of metadata.
UnrefBytes() uint64
// DiskUsage returns the estimated disk usage for the folder as of this revision of metadata.
DiskUsage() uint64
// RevisionNumber returns the revision number associated with this metadata structure.
RevisionNumber() MetadataRevision
// BID returns the per-device branch ID associated with this metadata revision.
BID() BranchID
// GetPrevRoot returns the hash of the previous metadata revision.
GetPrevRoot() MdID
// IsUnmergedSet returns true if the unmerged bit is set.
IsUnmergedSet() bool
// GetSerializedPrivateMetadata returns the serialized private metadata as a byte slice.
GetSerializedPrivateMetadata() []byte
// GetSerializedWriterMetadata serializes the underlying writer metadata and returns the result.
GetSerializedWriterMetadata(codec Codec) ([]byte, error)
// GetWriterMetadataSigInfo returns the signature info associated with the the writer metadata.
GetWriterMetadataSigInfo() SignatureInfo
// Version returns the metadata version.
Version() MetadataVer
}
BareRootMetadata is a read-only interface to the bare serializeable MD that is signed by the reader or writer.
type BareRootMetadataSignedV2 ¶
type BareRootMetadataSignedV2 struct {
// signature over the root metadata by the private signing key
SigInfo SignatureInfo `codec:",omitempty"`
// all the metadata
MD BareRootMetadataV2
}
BareRootMetadataSignedV2 is the MD that is signed by the reader or writer including the signature info. Unlike RootMetadataSigned, it contains exactly the serializable metadata and signature info.
type BareRootMetadataV2 ¶
type BareRootMetadataV2 struct {
// The metadata that is only editable by the writer.
//
// TODO: If we ever get a chance to update BareRootMetadata
// without having to be backwards-compatible, WriterMetadata
// should be unembedded; see comments to WriterMetadata as for
// why.
WriterMetadataV2
// The signature for the writer metadata, to prove
// that it's only been changed by writers.
WriterMetadataSigInfo SignatureInfo
// The last KB user who modified this BareRootMetadata
LastModifyingUser keybase1.UID
// Flags
Flags MetadataFlags
// The revision number
Revision MetadataRevision
// Pointer to the previous root block ID
PrevRoot MdID
// For private TLFs. Reader key generations for this metadata. The
// most recent one is last in the array. Must be same length as
// WriterMetadata.WKeys. If there are no readers, each generation
// is empty.
RKeys TLFReaderKeyGenerations `codec:",omitempty"`
// For private TLFs. Any unresolved social assertions for readers.
UnresolvedReaders []keybase1.SocialAssertion `codec:"ur,omitempty"`
// ConflictInfo is set if there's a conflict for the given folder's
// handle after a social assertion resolution.
ConflictInfo *TlfHandleExtension `codec:"ci,omitempty"`
// FinalizedInfo is set if there are no more valid writer keys capable
// of writing to the given folder.
FinalizedInfo *TlfHandleExtension `codec:"fi,omitempty"`
codec.UnknownFieldSetHandler
}
BareRootMetadataV2 is the MD that is signed by the reader or writer. Unlike RootMetadata, it contains exactly the serializable metadata.
func (*BareRootMetadataV2) AddDiskUsage ¶
func (md *BareRootMetadataV2) AddDiskUsage(diskUsage uint64)
AddDiskUsage implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) AddNewKeys ¶
func (md *BareRootMetadataV2) AddNewKeys( wkb TLFWriterKeyBundle, rkb TLFReaderKeyBundle)
AddNewKeys implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) AddRefBytes ¶
func (md *BareRootMetadataV2) AddRefBytes(refBytes uint64)
AddRefBytes implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) AddUnrefBytes ¶
func (md *BareRootMetadataV2) AddUnrefBytes(unrefBytes uint64)
AddUnrefBytes implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) BID ¶
func (md *BareRootMetadataV2) BID() BranchID
BID implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) CheckValidSuccessor ¶
func (md *BareRootMetadataV2) CheckValidSuccessor( currID MdID, nextMd BareRootMetadata) error
CheckValidSuccessor implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) CheckValidSuccessorForServer ¶
func (md *BareRootMetadataV2) CheckValidSuccessorForServer( currID MdID, nextMd BareRootMetadata) error
CheckValidSuccessorForServer implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) ClearFinalBit ¶
func (md *BareRootMetadataV2) ClearFinalBit()
ClearFinalBit implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) ClearRekeyBit ¶
func (md *BareRootMetadataV2) ClearRekeyBit()
ClearRekeyBit implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) ClearWriterMetadataCopiedBit ¶
func (md *BareRootMetadataV2) ClearWriterMetadataCopiedBit()
ClearWriterMetadataCopiedBit implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) DeepCopy ¶
func (md *BareRootMetadataV2) DeepCopy(codec Codec) (BareRootMetadata, error)
DeepCopy implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) DiskUsage ¶
func (md *BareRootMetadataV2) DiskUsage() uint64
DiskUsage implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) FakeInitialRekey ¶
func (md *BareRootMetadataV2) FakeInitialRekey(h BareTlfHandle)
FakeInitialRekey implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetDeviceKIDs ¶
func (md *BareRootMetadataV2) GetDeviceKIDs( keyGen KeyGen, user keybase1.UID) ([]keybase1.KID, error)
GetDeviceKIDs implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetLastModifyingUser ¶
func (md *BareRootMetadataV2) GetLastModifyingUser() keybase1.UID
GetLastModifyingUser implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetPrevRoot ¶
func (md *BareRootMetadataV2) GetPrevRoot() MdID
GetPrevRoot implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetSerializedPrivateMetadata ¶
func (md *BareRootMetadataV2) GetSerializedPrivateMetadata() []byte
GetSerializedPrivateMetadata implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetSerializedWriterMetadata ¶
func (md *BareRootMetadataV2) GetSerializedWriterMetadata(codec Codec) ([]byte, error)
GetSerializedWriterMetadata implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetTLFCryptKeyParams ¶
func (md *BareRootMetadataV2) GetTLFCryptKeyParams( keyGen KeyGen, user keybase1.UID, key CryptPublicKey) ( TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, TLFCryptKeyServerHalfID, bool, error)
GetTLFCryptKeyParams implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetTLFKeyBundles ¶
func (md *BareRootMetadataV2) GetTLFKeyBundles(keyGen KeyGen) ( *TLFWriterKeyBundle, *TLFReaderKeyBundle, error)
GetTLFKeyBundles implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetWriterMetadataSigInfo ¶
func (md *BareRootMetadataV2) GetWriterMetadataSigInfo() SignatureInfo
GetWriterMetadataSigInfo implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) HasKeyForUser ¶
func (md *BareRootMetadataV2) HasKeyForUser( keyGen KeyGen, user keybase1.UID) bool
HasKeyForUser implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsFinal ¶
func (md *BareRootMetadataV2) IsFinal() bool
IsFinal implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsLastModifiedBy ¶
func (md *BareRootMetadataV2) IsLastModifiedBy( uid keybase1.UID, key VerifyingKey) error
IsLastModifiedBy implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsReader ¶
func (md *BareRootMetadataV2) IsReader( user keybase1.UID, deviceKID keybase1.KID) bool
IsReader implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsRekeySet ¶
func (md *BareRootMetadataV2) IsRekeySet() bool
IsRekeySet implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsUnmergedSet ¶
func (md *BareRootMetadataV2) IsUnmergedSet() bool
IsUnmergedSet implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsValidAndSigned ¶
func (md *BareRootMetadataV2) IsValidAndSigned( codec Codec, crypto cryptoPure) error
IsValidAndSigned implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsValidRekeyRequest ¶
func (md *BareRootMetadataV2) IsValidRekeyRequest( codec Codec, prevBareMd BareRootMetadata, user keybase1.UID) ( bool, error)
IsValidRekeyRequest implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsWriter ¶
func (md *BareRootMetadataV2) IsWriter( user keybase1.UID, deviceKID keybase1.KID) bool
IsWriter implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsWriterMetadataCopiedSet ¶
func (md *BareRootMetadataV2) IsWriterMetadataCopiedSet() bool
IsWriterMetadataCopiedSet implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) LastModifyingWriter ¶
func (md *BareRootMetadataV2) LastModifyingWriter() keybase1.UID
LastModifyingWriter implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) LastModifyingWriterKID ¶
func (md *BareRootMetadataV2) LastModifyingWriterKID() keybase1.KID
LastModifyingWriterKID implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) LatestKeyGeneration ¶
func (md *BareRootMetadataV2) LatestKeyGeneration() KeyGen
LatestKeyGeneration implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) MakeBareTlfHandle ¶
func (md *BareRootMetadataV2) MakeBareTlfHandle() (BareTlfHandle, error)
MakeBareTlfHandle implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) MergedStatus ¶
func (md *BareRootMetadataV2) MergedStatus() MergeStatus
MergedStatus implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) RefBytes ¶
func (md *BareRootMetadataV2) RefBytes() uint64
RefBytes implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) RevisionNumber ¶
func (md *BareRootMetadataV2) RevisionNumber() MetadataRevision
RevisionNumber implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetBranchID ¶
func (md *BareRootMetadataV2) SetBranchID(bid BranchID)
SetBranchID implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetConflictInfo ¶
func (md *BareRootMetadataV2) SetConflictInfo(ci *TlfHandleExtension)
SetConflictInfo implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetDiskUsage ¶
func (md *BareRootMetadataV2) SetDiskUsage(diskUsage uint64)
SetDiskUsage implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetFinalBit ¶
func (md *BareRootMetadataV2) SetFinalBit()
SetFinalBit implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetFinalizedInfo ¶
func (md *BareRootMetadataV2) SetFinalizedInfo(fi *TlfHandleExtension)
SetFinalizedInfo implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetLastModifyingUser ¶
func (md *BareRootMetadataV2) SetLastModifyingUser(user keybase1.UID)
SetLastModifyingUser implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetLastModifyingWriter ¶
func (md *BareRootMetadataV2) SetLastModifyingWriter(user keybase1.UID)
SetLastModifyingWriter implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetPrevRoot ¶
func (md *BareRootMetadataV2) SetPrevRoot(mdID MdID)
SetPrevRoot implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetRefBytes ¶
func (md *BareRootMetadataV2) SetRefBytes(refBytes uint64)
SetRefBytes implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetRekeyBit ¶
func (md *BareRootMetadataV2) SetRekeyBit()
SetRekeyBit implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetRevision ¶
func (md *BareRootMetadataV2) SetRevision(revision MetadataRevision)
SetRevision implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetSerializedPrivateMetadata ¶
func (md *BareRootMetadataV2) SetSerializedPrivateMetadata(spmd []byte)
SetSerializedPrivateMetadata implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetTlfID ¶
func (md *BareRootMetadataV2) SetTlfID(tlf TlfID)
SetTlfID implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetUnmerged ¶
func (md *BareRootMetadataV2) SetUnmerged()
SetUnmerged implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetUnrefBytes ¶
func (md *BareRootMetadataV2) SetUnrefBytes(unrefBytes uint64)
SetUnrefBytes implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetUnresolvedReaders ¶
func (md *BareRootMetadataV2) SetUnresolvedReaders(readers []keybase1.SocialAssertion)
SetUnresolvedReaders implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetUnresolvedWriters ¶
func (md *BareRootMetadataV2) SetUnresolvedWriters(writers []keybase1.SocialAssertion)
SetUnresolvedWriters implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetWriterMetadataCopiedBit ¶
func (md *BareRootMetadataV2) SetWriterMetadataCopiedBit()
SetWriterMetadataCopiedBit implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetWriterMetadataSigInfo ¶
func (md *BareRootMetadataV2) SetWriterMetadataSigInfo(sigInfo SignatureInfo)
SetWriterMetadataSigInfo implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SetWriters ¶
func (md *BareRootMetadataV2) SetWriters(writers []keybase1.UID)
SetWriters implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) TlfHandleExtensions ¶
func (md *BareRootMetadataV2) TlfHandleExtensions() ( extensions []TlfHandleExtension)
TlfHandleExtensions implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) TlfID ¶
func (md *BareRootMetadataV2) TlfID() TlfID
TlfID implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) UnrefBytes ¶
func (md *BareRootMetadataV2) UnrefBytes() uint64
UnrefBytes implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) Update ¶
func (md *BareRootMetadataV2) Update(id TlfID, h BareTlfHandle) error
Update implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) Version ¶
func (md *BareRootMetadataV2) Version() MetadataVer
Version implements the MutableBareRootMetadata interface for BareRootMetadataV2.
type BareTlfHandle ¶
type BareTlfHandle struct {
Writers []keybase1.UID `codec:"w,omitempty"`
Readers []keybase1.UID `codec:"r,omitempty"`
UnresolvedWriters []keybase1.SocialAssertion `codec:"uw,omitempty"`
UnresolvedReaders []keybase1.SocialAssertion `codec:"ur,omitempty"`
ConflictInfo *TlfHandleExtension `codec:"ci,omitempty"`
FinalizedInfo *TlfHandleExtension `codec:"fi,omitempty"`
}
BareTlfHandle uniquely identifies top-level folders by readers and writers.
TODO: Have separate types for writers vs. readers.
func MakeBareTlfHandle ¶
func MakeBareTlfHandle( writers, readers []keybase1.UID, unresolvedWriters, unresolvedReaders []keybase1.SocialAssertion, extensions []TlfHandleExtension) (BareTlfHandle, error)
MakeBareTlfHandle creates a BareTlfHandle from the given list of readers and writers. If the given reader list contains just keybase1.PUBLIC_UID, then the returned handle will be for a public folder. Otherwise, it will be private. PUBLIC_UID shouldn't be in any list in any other case.
func (BareTlfHandle) Extensions ¶
func (h BareTlfHandle) Extensions() (extensions []TlfHandleExtension)
Extensions returns a list of extensions for the given handle.
func (BareTlfHandle) HasUnresolvedUsers ¶
func (h BareTlfHandle) HasUnresolvedUsers() bool
HasUnresolvedUsers returns true if this handle has any unresolved writers or readers.
func (BareTlfHandle) IsConflict ¶
func (h BareTlfHandle) IsConflict() bool
IsConflict returns true if the handle is a conflict handle.
func (BareTlfHandle) IsFinal ¶
func (h BareTlfHandle) IsFinal() bool
IsFinal returns true if the handle has been finalized.
func (BareTlfHandle) IsPublic ¶
func (h BareTlfHandle) IsPublic() bool
IsPublic returns whether or not this BareTlfHandle represents a public top-level folder.
func (BareTlfHandle) IsReader ¶
func (h BareTlfHandle) IsReader(user keybase1.UID) bool
IsReader returns whether or not the given user is a reader for the top-level folder represented by this BareTlfHandle.
func (BareTlfHandle) IsWriter ¶
func (h BareTlfHandle) IsWriter(user keybase1.UID) bool
IsWriter returns whether or not the given user is a writer for the top-level folder represented by this BareTlfHandle.
func (BareTlfHandle) ResolveAssertions ¶
func (h BareTlfHandle) ResolveAssertions( assertions map[keybase1.SocialAssertion]keybase1.UID) BareTlfHandle
ResolveAssertions creates a new BareTlfHandle given an existing one with while resolving the passed assertions.
func (BareTlfHandle) ResolvedUsers ¶
func (h BareTlfHandle) ResolvedUsers() []keybase1.UID
ResolvedUsers returns the concatenation of h.Writers and h.Readers, except if the handle is public, the returned list won't contain PUBLIC_UID.
func (BareTlfHandle) UnresolvedUsers ¶
func (h BareTlfHandle) UnresolvedUsers() []keybase1.SocialAssertion
UnresolvedUsers returns the concatenation of h.UnresolvedWriters and h.UnresolvedReaders.
type Block ¶
type Block interface {
// GetEncodedSize returns the encoded size of this block, but only
// if it has been previously set; otherwise it returns 0.
GetEncodedSize() uint32
// SetEncodedSize sets the encoded size of this block, locally
// caching it. The encoded size is not serialized.
SetEncodedSize(size uint32)
// DataVersion returns the data version for this block
DataVersion() DataVer
}
Block just needs to be (de)serialized using msgpack
func NewCommonBlock ¶
func NewCommonBlock() Block
NewCommonBlock returns a generic block, unsuitable for caching.
type BlockCache ¶
type BlockCache interface {
// Get gets the block associated with the given block ID.
Get(ptr BlockPointer) (Block, error)
// CheckForKnownPtr sees whether this cache has a transient
// entry for the given file block, which must be a direct file
// block containing data). Returns the full BlockPointer
// associated with that ID, including key and data versions.
// If no ID is known, return an uninitialized BlockPointer and
// a nil error.
CheckForKnownPtr(tlf TlfID, block *FileBlock) (BlockPointer, error)
// Put stores the final (content-addressable) block associated
// with the given block ID. If lifetime is TransientEntry,
// then it is assumed that the block exists on the server and
// the entry may be evicted from the cache at any time. If
// lifetime is PermanentEntry, then it is assumed that the
// block doesn't exist on the server and must remain in the
// cache until explicitly removed. As an intermediary state,
// as when a block is being sent to the server, the block may
// be put into the cache both with TransientEntry and
// PermanentEntry -- these are two separate entries. This is
// fine, since the block should be the same.
Put(ptr BlockPointer, tlf TlfID, block Block,
lifetime BlockCacheLifetime) error
// DeleteTransient removes the transient entry for the given
// pointer from the cache, as well as any cached IDs so the block
// won't be reused.
DeleteTransient(ptr BlockPointer, tlf TlfID) error
// Delete removes the permanent entry for the non-dirty block
// associated with the given block ID from the cache. No
// error is returned if no block exists for the given ID.
DeletePermanent(id BlockID) error
// DeleteKnownPtr removes the cached ID for the given file
// block. It does not remove the block itself.
DeleteKnownPtr(tlf TlfID, block *FileBlock) error
}
BlockCache gets and puts plaintext dir blocks and file blocks into a cache. These blocks are immutable and identified by their content hash.
type BlockCacheLifetime ¶
type BlockCacheLifetime int
BlockCacheLifetime denotes the lifetime of an entry in BlockCache.
const ( // TransientEntry means that the cache entry may be evicted at // any time. TransientEntry BlockCacheLifetime = iota // PermanentEntry means that the cache entry must remain until // explicitly removed from the cache. PermanentEntry )
type BlockCacheStandard ¶
type BlockCacheStandard struct {
// contains filtered or unexported fields
}
BlockCacheStandard implements the BlockCache interface by storing blocks in an in-memory LRU cache. Clean blocks are identified internally by just their block ID (since blocks are immutable and content-addressable).
func NewBlockCacheStandard ¶
func NewBlockCacheStandard(config Config, transientCapacity int, cleanBytesCapacity uint64) *BlockCacheStandard
NewBlockCacheStandard constructs a new BlockCacheStandard instance with the given transient capacity (in number of entries) and the clean bytes capacity, which is the total of number of bytes allowed between the transient and permanent clean caches. If putting a block will exceed this bytes capacity, transient entries are evicted until the block will fit in capacity.
func (*BlockCacheStandard) CheckForKnownPtr ¶
func (b *BlockCacheStandard) CheckForKnownPtr(tlf TlfID, block *FileBlock) ( BlockPointer, error)
CheckForKnownPtr implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) DeleteKnownPtr ¶
func (b *BlockCacheStandard) DeleteKnownPtr(tlf TlfID, block *FileBlock) error
DeleteKnownPtr implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) DeletePermanent ¶
func (b *BlockCacheStandard) DeletePermanent(id BlockID) error
DeletePermanent implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) DeleteTransient ¶
func (b *BlockCacheStandard) DeleteTransient( ptr BlockPointer, tlf TlfID) error
DeleteTransient implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) Get ¶
func (b *BlockCacheStandard) Get(ptr BlockPointer) (Block, error)
Get implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) Put ¶
func (b *BlockCacheStandard) Put( ptr BlockPointer, tlf TlfID, block Block, lifetime BlockCacheLifetime) error
Put implements the BlockCache interface for BlockCacheStandard.
type BlockChanges ¶
type BlockChanges struct {
// If this is set, the actual changes are stored in a block (where
// the block contains a serialized version of BlockChanges)
Info BlockInfo `codec:"p,omitempty"`
// An ordered list of operations completed in this update
Ops opsList `codec:"o,omitempty"`
// contains filtered or unexported fields
}
BlockChanges tracks the set of blocks that changed in a commit, and the operations that made the changes. It might consist of just a BlockPointer if the list is too big to embed in the MD structure directly.
If this commit represents a conflict-resolution merge, which may comprise multiple individual operations, then there will be an ordered list of the changes for individual operations. This lets the notification and conflict resolution strategies figure out the difference between a renamed file and a modified file, for example.
NOTE: Don't add or modify anything in this struct without considering how old clients will handle them.
func (*BlockChanges) AddOp ¶
func (bc *BlockChanges) AddOp(o op)
AddOp starts a new operation for this BlockChanges. Subsequent Add* calls will populate this operation.
func (*BlockChanges) AddRefBlock ¶
func (bc *BlockChanges) AddRefBlock(ptr BlockPointer)
AddRefBlock adds the newly-referenced block to this BlockChanges and updates the size estimate.
func (*BlockChanges) AddUnrefBlock ¶
func (bc *BlockChanges) AddUnrefBlock(ptr BlockPointer)
AddUnrefBlock adds the newly unreferenced block to this BlockChanges and updates the size estimate.
func (*BlockChanges) AddUpdate ¶
func (bc *BlockChanges) AddUpdate(oldPtr BlockPointer, newPtr BlockPointer)
AddUpdate adds the newly updated block to this BlockChanges and updates the size estimate.
func (BlockChanges) Equals ¶
func (bc BlockChanges) Equals(other BlockChanges) bool
Equals returns true if the given BlockChanges is equal to this BlockChanges. Currently does not check for equality at the operation level.
func (*BlockChanges) SizeEstimate ¶
func (bc *BlockChanges) SizeEstimate() uint64
SizeEstimate calculates the estimated size of the encoded version of this BlockChanges.
type BlockContext ¶
type BlockContext 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 BlockRefNonce `codec:"r,omitempty"`
}
BlockContext 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 (BlockContext) GetCreator ¶
func (c BlockContext) GetCreator() keybase1.UID
GetCreator returns the creator of the associated block.
func (BlockContext) GetRefNonce ¶
func (c BlockContext) GetRefNonce() BlockRefNonce
GetRefNonce returns the ref nonce of the associated block.
func (BlockContext) GetWriter ¶
func (c BlockContext) GetWriter() keybase1.UID
GetWriter returns the writer of the associated block.
func (BlockContext) IsFirstRef ¶
func (c BlockContext) IsFirstRef() bool
IsFirstRef returns whether or not p represents the first reference to the corresponding BlockID.
func (*BlockContext) SetWriter ¶
func (c *BlockContext) SetWriter(newWriter keybase1.UID)
SetWriter sets the Writer field, if necessary.
func (BlockContext) String ¶
func (c BlockContext) String() string
type BlockCryptKey ¶
type BlockCryptKey struct {
// contains filtered or unexported fields
}
BlockCryptKey is used to encrypt/decrypt block data. (See 4.1.2.)
func MakeBlockCryptKey ¶
func MakeBlockCryptKey(data [32]byte) BlockCryptKey
MakeBlockCryptKey returns a BlockCryptKey containing the given data.
Copies of BlockCryptKey objects are deep copies.
func (BlockCryptKey) MarshalBinary ¶
func (*BlockCryptKey) UnmarshalBinary ¶
type BlockCryptKeyServerHalf ¶
type BlockCryptKeyServerHalf struct {
// contains filtered or unexported fields
}
BlockCryptKeyServerHalf is a masked version of a BlockCryptKey, which can be recovered only with the TLFCryptKey used to mask the server half.
Copies of BlockCryptKeyServerHalf objects are deep copies.
func MakeBlockCryptKeyServerHalf ¶
func MakeBlockCryptKeyServerHalf(data [32]byte) BlockCryptKeyServerHalf
MakeBlockCryptKeyServerHalf returns a BlockCryptKeyServerHalf containing the given data.
func ParseBlockCryptKeyServerHalf ¶
func ParseBlockCryptKeyServerHalf(s string) (BlockCryptKeyServerHalf, error)
ParseBlockCryptKeyServerHalf returns a BlockCryptKeyServerHalf containing the given hex-encoded data, or an error.
func (BlockCryptKeyServerHalf) MarshalBinary ¶
func (*BlockCryptKeyServerHalf) UnmarshalBinary ¶
type BlockDecodeError ¶
type BlockDecodeError struct {
// contains filtered or unexported fields
}
BlockDecodeError indicates that a block couldn't be decoded as expected; probably it is the wrong type.
func (BlockDecodeError) Error ¶
func (e BlockDecodeError) Error() string
Error implements the error interface for BlockDecodeError
type BlockID ¶
type BlockID struct {
// contains filtered or unexported fields
}
BlockID is the (usually content-based) ID for a data block.
func BlockIDFromString ¶
BlockIDFromString creates a BlockID from the given string. If the returned error is nil, the returned BlockID is valid.
func RandomBlockID ¶
func RandomBlockID() BlockID
RandomBlockID returns a randomly-generated BlockID for testing.
func (BlockID) IsValid ¶
IsValid returns whether the block ID is valid. A zero block ID is considered invalid.
func (BlockID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for BlockID. Returns an error if the BlockID is invalid and not the zero BlockID.
func (*BlockID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for BlockID. Returns an error if the given byte array is non-empty and the BlockID is invalid.
type BlockInfo ¶
type BlockInfo struct {
BlockPointer
// When non-zero, the size of the encoded (and possibly
// encrypted) data contained in the block. When non-zero,
// always at least the size of the plaintext data contained in
// the block.
EncodedSize uint32 `codec:"e"`
}
BlockInfo contains all information about a block in KBFS and its contents.
NOTE: Don't add or modify anything in this struct without considering how old clients will handle them.
type BlockOps ¶
type BlockOps interface {
// Get gets the block associated with the given block pointer
// (which belongs to the TLF with the given key metadata),
// decrypts it if necessary, and fills in the provided block
// object with its contents, if the logged-in user has read
// permission for that block.
Get(ctx context.Context, kmd KeyMetadata, blockPtr BlockPointer,
block Block) error
// Ready turns the given block (which belongs to the TLF with
// the given key metadata) into encoded (and encrypted) data,
// and calculates its ID and size, so that we can do a bunch
// of block puts in parallel for every write. Ready() must
// guarantee that plainSize <= readyBlockData.QuotaSize().
Ready(ctx context.Context, kmd KeyMetadata, block Block) (
id BlockID, plainSize int, readyBlockData ReadyBlockData, err error)
// Put stores the readied block data under the given block
// pointer (which belongs to the TLF with the given ID) on the
// server.
Put(ctx context.Context, tlfID TlfID, blockPtr BlockPointer,
readyBlockData ReadyBlockData) error
// Delete instructs the server to delete the given block references.
// It returns the number of not-yet deleted references to
// each block reference
Delete(ctx context.Context, tlfID TlfID, ptrs []BlockPointer) (
liveCounts map[BlockID]int, err error)
// Archive instructs the server to mark the given block references
// as "archived"; that is, they are not being used in the current
// view of the folder, and shouldn't be served to anyone other
// than folder writers.
Archive(ctx context.Context, tlfID TlfID, ptrs []BlockPointer) error
}
BlockOps gets and puts data blocks to a BlockServer. It performs the necessary crypto operations on each block.
type BlockOpsConstrained ¶
type BlockOpsConstrained struct {
BlockOps
// contains filtered or unexported fields
}
BlockOpsConstrained implements the BlockOps interface by relaying requests to a delegate BlockOps, but it delays all Puts by simulating a bottleneck of the given bandwidth.
func NewBlockOpsConstrained ¶
func NewBlockOpsConstrained(delegate BlockOps, bwKBps int) *BlockOpsConstrained
NewBlockOpsConstrained constructs a new BlockOpsConstrained.
func (*BlockOpsConstrained) Put ¶
func (b *BlockOpsConstrained) Put(ctx context.Context, tlfID TlfID, blockPtr BlockPointer, readyBlockData ReadyBlockData) error
Put implements the BlockOps interface for BlockOpsConstrained.
type BlockOpsStandard ¶
type BlockOpsStandard struct {
// contains filtered or unexported fields
}
BlockOpsStandard implements the BlockOps interface by relaying requests to the block server.
func (*BlockOpsStandard) Archive ¶
func (b *BlockOpsStandard) Archive(ctx context.Context, tlfID TlfID, ptrs []BlockPointer) error
Archive implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) Delete ¶
func (b *BlockOpsStandard) Delete(ctx context.Context, tlfID TlfID, ptrs []BlockPointer) (liveCounts map[BlockID]int, err error)
Delete implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) Get ¶
func (b *BlockOpsStandard) Get(ctx context.Context, kmd KeyMetadata, blockPtr BlockPointer, block Block) error
Get implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) Put ¶
func (b *BlockOpsStandard) Put(ctx context.Context, tlfID TlfID, blockPtr BlockPointer, readyBlockData ReadyBlockData) error
Put implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) Ready ¶
func (b *BlockOpsStandard) Ready(ctx context.Context, kmd KeyMetadata, block Block) (id BlockID, plainSize int, readyBlockData ReadyBlockData, err error)
Ready implements the BlockOps interface for BlockOpsStandard.
type BlockPointer ¶
type BlockPointer struct {
ID BlockID `codec:"i"`
KeyGen KeyGen `codec:"k"` // if valid, which generation of the TLF{Writer,Reader}KeyBundle to use.
DataVer DataVer `codec:"d"` // if valid, which version of the KBFS data structures is pointed to
BlockContext
}
BlockPointer contains the identifying information for a block in KBFS.
NOTE: Don't add or modify anything in this struct without considering how old clients will handle them.
func (BlockPointer) IsInitialized ¶
func (p BlockPointer) IsInitialized() bool
IsInitialized returns whether or not this BlockPointer has non-nil data.
func (BlockPointer) IsValid ¶
func (p BlockPointer) IsValid() bool
IsValid returns whether the block pointer is valid. A zero block pointer is considered invalid.
func (BlockPointer) String ¶
func (p BlockPointer) String() string
type BlockRefNonce ¶
type BlockRefNonce [8]byte
BlockRefNonce 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 (BlockRefNonce) String ¶
func (nonce BlockRefNonce) String() string
type BlockServer ¶
type BlockServer interface {
AuthTokenRefreshHandler
// Get gets the (encrypted) block data associated with the given
// block ID and context, uses the provided block key to decrypt
// the block, and fills in the provided block object with its
// contents, if the logged-in user has read permission for that
// block.
Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) (
[]byte, BlockCryptKeyServerHalf, error)
// Put stores the (encrypted) block data under the given ID and
// context on the server, along with the server half of the block
// key. context should contain a BlockRefNonce of zero. There
// will be an initial reference for this block for the given
// context.
//
// Put should be idempotent, although it should also return an
// error if, for a given ID, any of the other arguments differ
// from previous Put calls with the same ID.
//
// If this returns a BServerErrorOverQuota, with Throttled=false,
// the caller can treat it as informational and otherwise ignore
// the error.
Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext,
buf []byte, serverHalf BlockCryptKeyServerHalf) error
// AddBlockReference adds a new reference to the given block,
// defined by the given context (which should contain a non-zero
// BlockRefNonce). (Contexts with a BlockRefNonce of zero should
// be used when putting the block for the first time via Put().)
// Returns a BServerErrorBlockNonExistent if id is unknown within
// this folder.
//
// AddBlockReference should be idempotent, although it should
// also return an error if, for a given ID and refnonce, any
// of the other fields of context differ from previous
// AddBlockReference calls with the same ID and refnonce.
//
// If this returns a BServerErrorOverQuota, with Throttled=false,
// the caller can treat it as informational and otherwise ignore
// the error.
AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID,
context BlockContext) error
// RemoveBlockReferences removes the references to the given block
// ID defined by the given contexts. If no references to the block
// remain after this call, the server is allowed to delete the
// corresponding block permanently. If the reference defined by
// the count has already been removed, the call is a no-op.
// It returns the number of remaining not-yet-deleted references after this
// reference has been removed
RemoveBlockReferences(ctx context.Context, tlfID TlfID,
contexts map[BlockID][]BlockContext) (liveCounts map[BlockID]int, err error)
// ArchiveBlockReferences marks the given block references as
// "archived"; that is, they are not being used in the current
// view of the folder, and shouldn't be served to anyone other
// than folder writers.
//
// For a given ID/refnonce pair, ArchiveBlockReferences should
// be idempotent, although it should also return an error if
// any of the other fields of the context differ from previous
// calls with the same ID/refnonce pair.
ArchiveBlockReferences(ctx context.Context, tlfID TlfID,
contexts map[BlockID][]BlockContext) error
// Shutdown is called to shutdown a BlockServer connection.
Shutdown()
// GetUserQuotaInfo returns the quota for the user.
GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
}
BlockServer gets and puts opaque data blocks. The instantiation should be able to fetch session/user details via KBPKI. On a put/delete, the server is reponsible for: 1) checking that the ID matches the hash of the buffer; and 2) enforcing writer quotas.
type BlockServerDisk ¶
type BlockServerDisk struct {
// contains filtered or unexported fields
}
BlockServerDisk implements the BlockServer interface by just storing blocks in a local leveldb instance.
func NewBlockServerDir ¶
func NewBlockServerDir(config Config, dirPath string) *BlockServerDisk
NewBlockServerDir constructs a new BlockServerDisk that stores its data in the given directory.
func NewBlockServerTempDir ¶
func NewBlockServerTempDir(config Config) (*BlockServerDisk, error)
NewBlockServerTempDir constructs a new BlockServerDisk that stores its data in a temp directory which is cleaned up on shutdown.
func (*BlockServerDisk) AddBlockReference ¶
func (b *BlockServerDisk) AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) error
AddBlockReference implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) ArchiveBlockReferences ¶
func (b *BlockServerDisk) ArchiveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) error
ArchiveBlockReferences implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) Get ¶
func (b *BlockServerDisk) Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) ([]byte, BlockCryptKeyServerHalf, error)
Get implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) GetUserQuotaInfo ¶
func (b *BlockServerDisk) GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
GetUserQuotaInfo implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) Put ¶
func (b *BlockServerDisk) Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext, buf []byte, serverHalf BlockCryptKeyServerHalf) error
Put implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) RefreshAuthToken ¶
func (b *BlockServerDisk) RefreshAuthToken(_ context.Context)
RefreshAuthToken implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) RemoveBlockReferences ¶
func (b *BlockServerDisk) RemoveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) ( liveCounts map[BlockID]int, err error)
RemoveBlockReferences implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) Shutdown ¶
func (b *BlockServerDisk) Shutdown()
Shutdown implements the BlockServer interface for BlockServerDisk.
type BlockServerMeasured ¶
type BlockServerMeasured struct {
// contains filtered or unexported fields
}
BlockServerMeasured delegates to another BlockServer instance but also keeps track of stats.
func NewBlockServerMeasured ¶
func NewBlockServerMeasured(delegate BlockServer, r metrics.Registry) BlockServerMeasured
NewBlockServerMeasured creates and returns a new BlockServerMeasured instance with the given delegate and registry.
func (BlockServerMeasured) AddBlockReference ¶
func (b BlockServerMeasured) AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) (err error)
AddBlockReference implements the BlockServer interface for BlockServerMeasured.
func (BlockServerMeasured) ArchiveBlockReferences ¶
func (b BlockServerMeasured) ArchiveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (err error)
ArchiveBlockReferences implements the BlockServer interface for BlockServerRemote
func (BlockServerMeasured) Get ¶
func (b BlockServerMeasured) Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) ( buf []byte, serverHalf BlockCryptKeyServerHalf, err error)
Get implements the BlockServer interface for BlockServerMeasured.
func (BlockServerMeasured) GetUserQuotaInfo ¶
func (b BlockServerMeasured) GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
GetUserQuotaInfo implements the BlockServer interface for BlockServerMeasured
func (BlockServerMeasured) Put ¶
func (b BlockServerMeasured) Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext, buf []byte, serverHalf BlockCryptKeyServerHalf) (err error)
Put implements the BlockServer interface for BlockServerMeasured.
func (BlockServerMeasured) RefreshAuthToken ¶
func (b BlockServerMeasured) RefreshAuthToken(ctx context.Context)
RefreshAuthToken implements the BlockServer interface for BlockServerMeasured.
func (BlockServerMeasured) RemoveBlockReferences ¶
func (b BlockServerMeasured) RemoveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) ( liveCounts map[BlockID]int, err error)
RemoveBlockReferences implements the BlockServer interface for BlockServerMeasured.
func (BlockServerMeasured) Shutdown ¶
func (b BlockServerMeasured) Shutdown()
Shutdown implements the BlockServer interface for BlockServerMeasured.
type BlockServerMemory ¶
type BlockServerMemory struct {
// contains filtered or unexported fields
}
BlockServerMemory implements the BlockServer interface by just storing blocks in memory.
func NewBlockServerMemory ¶
func NewBlockServerMemory(config Config) *BlockServerMemory
NewBlockServerMemory constructs a new BlockServerMemory that stores its data in memory.
func (*BlockServerMemory) AddBlockReference ¶
func (b *BlockServerMemory) AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) error
AddBlockReference implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) ArchiveBlockReferences ¶
func (b *BlockServerMemory) ArchiveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) error
ArchiveBlockReferences implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) Get ¶
func (b *BlockServerMemory) Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) ([]byte, BlockCryptKeyServerHalf, error)
Get implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) GetUserQuotaInfo ¶
func (b *BlockServerMemory) GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
GetUserQuotaInfo implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) Put ¶
func (b *BlockServerMemory) Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext, buf []byte, serverHalf BlockCryptKeyServerHalf) error
Put implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) RefreshAuthToken ¶
func (b *BlockServerMemory) RefreshAuthToken(_ context.Context)
RefreshAuthToken implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) RemoveBlockReferences ¶
func (b *BlockServerMemory) RemoveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) ( liveCounts map[BlockID]int, err error)
RemoveBlockReferences implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) Shutdown ¶
func (b *BlockServerMemory) Shutdown()
Shutdown implements the BlockServer interface for BlockServerMemory.
type BlockServerRemote ¶
type BlockServerRemote struct {
// contains filtered or unexported fields
}
BlockServerRemote implements the BlockServer interface and represents a remote KBFS block server.
func NewBlockServerRemote ¶
func NewBlockServerRemote(config Config, blkSrvAddr string, ctx Context) *BlockServerRemote
NewBlockServerRemote constructs a new BlockServerRemote for the given address.
func (*BlockServerRemote) AddBlockReference ¶
func (b *BlockServerRemote) AddBlockReference(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) error
AddBlockReference implements the BlockServer interface for BlockServerRemote
func (*BlockServerRemote) ArchiveBlockReferences ¶
func (b *BlockServerRemote) ArchiveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (err error)
ArchiveBlockReferences implements the BlockServer interface for BlockServerRemote
func (*BlockServerRemote) Get ¶
func (b *BlockServerRemote) Get(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext) ([]byte, BlockCryptKeyServerHalf, error)
Get implements the BlockServer interface for BlockServerRemote.
func (*BlockServerRemote) GetUserQuotaInfo ¶
func (b *BlockServerRemote) GetUserQuotaInfo(ctx context.Context) (info *UserQuotaInfo, err error)
GetUserQuotaInfo implements the BlockServer interface for BlockServerRemote
func (*BlockServerRemote) HandlerName ¶
func (*BlockServerRemote) HandlerName() string
HandlerName implements the ConnectionHandler interface.
func (*BlockServerRemote) OnConnect ¶
func (b *BlockServerRemote) OnConnect(ctx context.Context, _ *rpc.Connection, client rpc.GenericClient, _ *rpc.Server) error
OnConnect implements the ConnectionHandler interface.
func (*BlockServerRemote) OnConnectError ¶
func (b *BlockServerRemote) OnConnectError(err error, wait time.Duration)
OnConnectError implements the ConnectionHandler interface.
func (*BlockServerRemote) OnDisconnected ¶
func (b *BlockServerRemote) OnDisconnected(ctx context.Context, status rpc.DisconnectStatus)
OnDisconnected implements the ConnectionHandler interface.
func (*BlockServerRemote) OnDoCommandError ¶
func (b *BlockServerRemote) OnDoCommandError(err error, wait time.Duration)
OnDoCommandError implements the ConnectionHandler interface.
func (*BlockServerRemote) Put ¶
func (b *BlockServerRemote) Put(ctx context.Context, tlfID TlfID, id BlockID, context BlockContext, buf []byte, serverHalf BlockCryptKeyServerHalf) error
Put implements the BlockServer interface for BlockServerRemote.
func (*BlockServerRemote) RefreshAuthToken ¶
func (b *BlockServerRemote) RefreshAuthToken(ctx context.Context)
RefreshAuthToken implements the AuthTokenRefreshHandler interface.
func (*BlockServerRemote) RemoteAddress ¶
func (b *BlockServerRemote) RemoteAddress() string
RemoteAddress returns the remote bserver this client is talking to
func (*BlockServerRemote) RemoveBlockReferences ¶
func (b *BlockServerRemote) RemoveBlockReferences(ctx context.Context, tlfID TlfID, contexts map[BlockID][]BlockContext) (liveCounts map[BlockID]int, err error)
RemoveBlockReferences implements the BlockServer interface for BlockServerRemote
func (*BlockServerRemote) ShouldRetry ¶
func (b *BlockServerRemote) ShouldRetry(rpcName string, err error) bool
ShouldRetry implements the ConnectionHandler interface.
func (*BlockServerRemote) ShouldRetryOnConnect ¶
func (b *BlockServerRemote) ShouldRetryOnConnect(err error) bool
ShouldRetryOnConnect implements the ConnectionHandler interface.
func (*BlockServerRemote) Shutdown ¶
func (b *BlockServerRemote) Shutdown()
Shutdown implements the BlockServer interface for BlockServerRemote.
type BlockSplitter ¶
type BlockSplitter interface {
// CopyUntilSplit copies data into the block until we reach the
// point where we should split, but only if writing to the end of
// the last block. If this is writing into the middle of a file,
// just copy everything that will fit into the block, and assume
// that block boundaries will be fixed later. Return how much was
// copied.
CopyUntilSplit(
block *FileBlock, lastBlock bool, data []byte, off int64) int64
// CheckSplit, given a block, figures out whether it ends at the
// right place. If so, return 0. If not, return either the
// offset in the block where it should be split, or -1 if more
// bytes from the next block should be appended.
CheckSplit(block *FileBlock) int64
// ShouldEmbedBlockChanges decides whether we should keep the
// block changes embedded in the MD or not.
ShouldEmbedBlockChanges(bc *BlockChanges) bool
}
BlockSplitter decides when a file or directory block needs to be split
type BlockSplitterSimple ¶
type BlockSplitterSimple struct {
// contains filtered or unexported fields
}
BlockSplitterSimple implements the BlockSplitter interface by using a simple max-size algorithm to determine when to split blocks.
func NewBlockSplitterSimple ¶
func NewBlockSplitterSimple(desiredBlockSize int64, blockChangeEmbedMaxSize uint64, codec Codec) (*BlockSplitterSimple, error)
NewBlockSplitterSimple creates a new BlockSplittleSimple and adjusts the max size to try to match the desired size for file blocks, given the overhead of encoding a file block and the round-up padding we do.
func (*BlockSplitterSimple) CheckSplit ¶
func (b *BlockSplitterSimple) CheckSplit(block *FileBlock) int64
CheckSplit implements the BlockSplitter interface for BlockSplitterSimple.
func (*BlockSplitterSimple) CopyUntilSplit ¶
func (b *BlockSplitterSimple) CopyUntilSplit( block *FileBlock, lastBlock bool, data []byte, off int64) int64
CopyUntilSplit implements the BlockSplitter interface for BlockSplitterSimple.
func (*BlockSplitterSimple) ShouldEmbedBlockChanges ¶
func (b *BlockSplitterSimple) ShouldEmbedBlockChanges( bc *BlockChanges) bool
ShouldEmbedBlockChanges implements the BlockSplitter interface for BlockSplitterSimple.
type BranchID ¶
type BranchID struct {
// contains filtered or unexported fields
}
BranchID encapsulates a per-device per-TLF branch ID.
func FakeBranchID ¶
FakeBranchID creates a fake branch ID from the given byte.
func ParseBranchID ¶
ParseBranchID parses a hex encoded BranchID. Returns NullBranchID and an InvalidBranchID on falire.
func (BranchID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for BranchID.
func (*BranchID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for BranchID.
type BranchName ¶
type BranchName string
BranchName is the name given to a KBFS branch, for a particular top-level folder. Currently, the notion of a "branch" is client-side only, and can be used to specify which root to use for a top-level folder. (For example, viewing a historical archive could use a different branch name.)
const ( // MasterBranch represents the mainline branch for a top-level // folder. Set to the empty string so that the default will be // the master branch. MasterBranch BranchName = "" )
type CRAbandonStagedBranchError ¶
CRAbandonStagedBranchError indicates that conflict resolution had to abandon a staged branch due to an unresolvable error.
func (CRAbandonStagedBranchError) Error ¶
func (e CRAbandonStagedBranchError) Error() string
type CRWrapError ¶
type CRWrapError struct {
// contains filtered or unexported fields
}
CRWrapError wraps an error that happens during conflict resolution.
func (CRWrapError) Error ¶
func (e CRWrapError) Error() string
Error implements the error interface for CRWrapError.
type CanonicalTlfName ¶
type CanonicalTlfName string
CanonicalTlfName is a string containing the canonical name of a TLF.
type Codec ¶
type Codec interface {
// Decode unmarshals the given buffer into the given object, if possible.
Decode(buf []byte, obj interface{}) error
// Encode marshals the given object into a returned buffer.
Encode(obj interface{}) ([]byte, error)
// RegisterType should be called for all types that are stored
// under ambiguous types (like interface{} or nil interface) in a
// struct that will be encoded/decoded by the codec. Each must
// have a unique extCode. Types that include other extension
// types are not supported.
RegisterType(rt reflect.Type, code extCode)
// RegisterIfaceSliceType should be called for all encoded slices
// that contain ambiguous interface types. Each must have a
// unique extCode. Slice element types that include other
// extension types are not supported.
//
// If non-nil, typer is used to do a type assertion during
// decoding, to convert the encoded value into the value expected
// by the rest of the code. This is needed, for example, when the
// codec cannot decode interface types to their desired pointer
// form.
RegisterIfaceSliceType(rt reflect.Type, code extCode,
typer func(interface{}) reflect.Value)
}
Codec encodes and decodes arbitrary data
type CodecMsgpack ¶
type CodecMsgpack struct {
// contains filtered or unexported fields
}
CodecMsgpack implements the Codec interface using msgpack marshaling and unmarshaling.
func NewCodecMsgpack ¶
func NewCodecMsgpack() *CodecMsgpack
NewCodecMsgpack constructs a new CodecMsgpack.
func (*CodecMsgpack) Decode ¶
func (c *CodecMsgpack) Decode(buf []byte, obj interface{}) (err error)
Decode implements the Codec interface for CodecMsgpack
func (*CodecMsgpack) Encode ¶
func (c *CodecMsgpack) Encode(obj interface{}) (buf []byte, err error)
Encode implements the Codec interface for CodecMsgpack
func (*CodecMsgpack) RegisterIfaceSliceType ¶
func (c *CodecMsgpack) RegisterIfaceSliceType(rt reflect.Type, code extCode, typer func(interface{}) reflect.Value)
RegisterIfaceSliceType implements the Codec interface for CodecMsgpack
func (*CodecMsgpack) RegisterType ¶
func (c *CodecMsgpack) RegisterType(rt reflect.Type, code extCode)
RegisterType implements the Codec interface for CodecMsgpack
type CommonBlock ¶
type CommonBlock struct {
// IsInd indicates where this block is so big it requires indirect pointers
IsInd bool `codec:"s"`
codec.UnknownFieldSetHandler
// contains filtered or unexported fields
}
CommonBlock holds block data that is common for both subdirectories and files.
func (*CommonBlock) DataVersion ¶
func (cb *CommonBlock) DataVersion() DataVer
DataVersion returns data version for this block.
func (CommonBlock) GetEncodedSize ¶
func (cb CommonBlock) GetEncodedSize() uint32
GetEncodedSize implements the Block interface for CommonBlock
func (*CommonBlock) SetEncodedSize ¶
func (cb *CommonBlock) SetEncodedSize(size uint32)
SetEncodedSize implements the Block interface for CommonBlock
type Config ¶
type Config interface {
KBFSOps() KBFSOps
SetKBFSOps(KBFSOps)
KBPKI() KBPKI
SetKBPKI(KBPKI)
KeyManager() KeyManager
SetKeyManager(KeyManager)
Reporter() Reporter
SetReporter(Reporter)
MDCache() MDCache
SetMDCache(MDCache)
KeyCache() KeyCache
SetKeyCache(KeyCache)
BlockCache() BlockCache
SetBlockCache(BlockCache)
DirtyBlockCache() DirtyBlockCache
SetDirtyBlockCache(DirtyBlockCache)
Crypto() Crypto
SetCrypto(Crypto)
Codec() Codec
SetCodec(Codec)
MDOps() MDOps
SetMDOps(MDOps)
KeyOps() KeyOps
SetKeyOps(KeyOps)
BlockOps() BlockOps
SetBlockOps(BlockOps)
MDServer() MDServer
SetMDServer(MDServer)
BlockServer() BlockServer
SetBlockServer(BlockServer)
KeyServer() KeyServer
SetKeyServer(KeyServer)
KeybaseService() KeybaseService
SetKeybaseService(KeybaseService)
BlockSplitter() BlockSplitter
SetBlockSplitter(BlockSplitter)
Notifier() Notifier
SetNotifier(Notifier)
Clock() Clock
SetClock(Clock)
ConflictRenamer() ConflictRenamer
SetConflictRenamer(ConflictRenamer)
MetadataVersion() MetadataVer
DataVersion() DataVer
RekeyQueue() RekeyQueue
SetRekeyQueue(RekeyQueue)
// ReqsBufSize indicates the number of read or write operations
// that can be buffered per folder
ReqsBufSize() int
// MaxFileBytes indicates the maximum supported plaintext size of
// a file in bytes.
MaxFileBytes() uint64
// MaxNameBytes indicates the maximum supported size of a
// directory entry name in bytes.
MaxNameBytes() uint32
// MaxDirBytes indicates the maximum supported plaintext size of a
// directory in bytes.
MaxDirBytes() uint64
// DoBackgroundFlushes says whether we should periodically try to
// flush dirty files, even without a sync from the user. Should
// be true except for during some testing.
DoBackgroundFlushes() bool
SetDoBackgroundFlushes(bool)
// RekeyWithPromptWaitTime indicates how long to wait, after
// setting the rekey bit, before prompting for a paper key.
RekeyWithPromptWaitTime() time.Duration
// QuotaReclamationPeriod indicates how often should each TLF
// should check for quota to reclaim. If the Duration.Seconds()
// == 0, quota reclamation should not run automatically.
QuotaReclamationPeriod() time.Duration
// QuotaReclamationMinUnrefAge indicates the minimum time a block
// must have been unreferenced before it can be reclaimed.
QuotaReclamationMinUnrefAge() time.Duration
// ResetCaches clears and re-initializes all data and key caches.
ResetCaches()
MakeLogger(module string) logger.Logger
SetLoggerMaker(func(module string) logger.Logger)
// MetricsRegistry may be nil, which should be interpreted as
// not using metrics at all. (i.e., as if UseNilMetrics were
// set). This differs from how go-metrics treats nil Registry
// objects, which is to use the default registry.
MetricsRegistry() metrics.Registry
SetMetricsRegistry(metrics.Registry)
// TLFValidDuration is the time TLFs are valid before identification needs to be redone.
TLFValidDuration() time.Duration
// SetTLFValidDuration sets TLFValidDuration.
SetTLFValidDuration(time.Duration)
// Shutdown is called to free config resources.
Shutdown() error
// CheckStateOnShutdown tells the caller whether or not it is safe
// to check the state of the system on shutdown.
CheckStateOnShutdown() bool
}
Config collects all the singleton instance instantiations needed to run KBFS in one place. The methods below are self-explanatory and do not require comments.
func Init ¶
func Init(ctx Context, params InitParams, keybaseServiceCn KeybaseServiceCn, onInterruptFn func(), log logger.Logger) (Config, error)
Init initializes a config and returns it.
onInterruptFn is called whenever an interrupt signal is received (e.g., if the user hits Ctrl-C).
Init should be called at the beginning of main. Shutdown (see below) should then be called at the end of main (usually via defer).
The keybaseServiceCn argument is to specify a custom service and crypto (for non-RPC environments) like mobile. If this is nil, we'll use the default RPC implementation.
type ConfigLocal ¶
type ConfigLocal struct {
// contains filtered or unexported fields
}
ConfigLocal implements the Config interface using purely local server objects (no KBFS operations used RPCs).
func ConfigAsUser ¶
func ConfigAsUser(config *ConfigLocal, loggedInUser libkb.NormalizedUsername) *ConfigLocal
ConfigAsUser clones a test configuration, setting another user as the logged in user
func MakeTestConfigOrBust ¶
func MakeTestConfigOrBust(t logger.TestLogBackend, users ...libkb.NormalizedUsername) *ConfigLocal
MakeTestConfigOrBust creates and returns a config suitable for unit-testing with the given list of users.
func NewConfigLocal ¶
func NewConfigLocal() *ConfigLocal
NewConfigLocal constructs a new ConfigLocal with default components.
func NewConfigLocalWithCrypto ¶
func NewConfigLocalWithCrypto() *ConfigLocal
NewConfigLocalWithCrypto initializes a local crypto config w/a crypto interface that can be used for non-PKI crypto.
func NewConfigLocalWithCryptoForSigning ¶
func NewConfigLocalWithCryptoForSigning(signingKey SigningKey) *ConfigLocal
NewConfigLocalWithCryptoForSigning initializes a local crypto config w/a crypto interface, using the given signing key, that can be used for non-PKI crypto.
func (*ConfigLocal) BlockCache ¶
func (c *ConfigLocal) BlockCache() BlockCache
BlockCache implements the Config interface for ConfigLocal.
func (*ConfigLocal) BlockOps ¶
func (c *ConfigLocal) BlockOps() BlockOps
BlockOps implements the Config interface for ConfigLocal.
func (*ConfigLocal) BlockServer ¶
func (c *ConfigLocal) BlockServer() BlockServer
BlockServer implements the Config interface for ConfigLocal.
func (*ConfigLocal) BlockSplitter ¶
func (c *ConfigLocal) BlockSplitter() BlockSplitter
BlockSplitter implements the Config interface for ConfigLocal.
func (*ConfigLocal) CheckStateOnShutdown ¶
func (c *ConfigLocal) CheckStateOnShutdown() bool
CheckStateOnShutdown implements the Config interface for ConfigLocal.
func (*ConfigLocal) Clock ¶
func (c *ConfigLocal) Clock() Clock
Clock implements the Config interface for ConfigLocal.
func (*ConfigLocal) Codec ¶
func (c *ConfigLocal) Codec() Codec
Codec implements the Config interface for ConfigLocal.
func (*ConfigLocal) ConflictRenamer ¶
func (c *ConfigLocal) ConflictRenamer() ConflictRenamer
ConflictRenamer implements the Config interface for ConfigLocal.
func (*ConfigLocal) Crypto ¶
func (c *ConfigLocal) Crypto() Crypto
Crypto implements the Config interface for ConfigLocal.
func (*ConfigLocal) DataVersion ¶
func (c *ConfigLocal) DataVersion() DataVer
DataVersion implements the Config interface for ConfigLocal.
func (*ConfigLocal) DirtyBlockCache ¶
func (c *ConfigLocal) DirtyBlockCache() DirtyBlockCache
DirtyBlockCache implements the Config interface for ConfigLocal.
func (*ConfigLocal) DoBackgroundFlushes ¶
func (c *ConfigLocal) DoBackgroundFlushes() bool
DoBackgroundFlushes implements the Config interface for ConfigLocal.
func (*ConfigLocal) KBFSOps ¶
func (c *ConfigLocal) KBFSOps() KBFSOps
KBFSOps implements the Config interface for ConfigLocal.
func (*ConfigLocal) KBPKI ¶
func (c *ConfigLocal) KBPKI() KBPKI
KBPKI implements the Config interface for ConfigLocal.
func (*ConfigLocal) KeyCache ¶
func (c *ConfigLocal) KeyCache() KeyCache
KeyCache implements the Config interface for ConfigLocal.
func (*ConfigLocal) KeyManager ¶
func (c *ConfigLocal) KeyManager() KeyManager
KeyManager implements the Config interface for ConfigLocal.
func (*ConfigLocal) KeyOps ¶
func (c *ConfigLocal) KeyOps() KeyOps
KeyOps implements the Config interface for ConfigLocal.
func (*ConfigLocal) KeyServer ¶
func (c *ConfigLocal) KeyServer() KeyServer
KeyServer implements the Config interface for ConfigLocal.
func (*ConfigLocal) KeybaseService ¶
func (c *ConfigLocal) KeybaseService() KeybaseService
KeybaseService implements the Config interface for ConfigLocal.
func (*ConfigLocal) MDCache ¶
func (c *ConfigLocal) MDCache() MDCache
MDCache implements the Config interface for ConfigLocal.
func (*ConfigLocal) MDOps ¶
func (c *ConfigLocal) MDOps() MDOps
MDOps implements the Config interface for ConfigLocal.
func (*ConfigLocal) MDServer ¶
func (c *ConfigLocal) MDServer() MDServer
MDServer implements the Config interface for ConfigLocal.
func (*ConfigLocal) MakeLogger ¶
func (c *ConfigLocal) MakeLogger(module string) logger.Logger
MakeLogger implements the Config interface for ConfigLocal.
func (*ConfigLocal) MaxDirBytes ¶
func (c *ConfigLocal) MaxDirBytes() uint64
MaxDirBytes implements the Config interface for ConfigLocal.
func (*ConfigLocal) MaxFileBytes ¶
func (c *ConfigLocal) MaxFileBytes() uint64
MaxFileBytes implements the Config interface for ConfigLocal.
func (*ConfigLocal) MaxNameBytes ¶
func (c *ConfigLocal) MaxNameBytes() uint32
MaxNameBytes implements the Config interface for ConfigLocal.
func (*ConfigLocal) MetadataVersion ¶
func (c *ConfigLocal) MetadataVersion() MetadataVer
MetadataVersion implements the Config interface for ConfigLocal.
func (*ConfigLocal) MetricsRegistry ¶
func (c *ConfigLocal) MetricsRegistry() metrics.Registry
MetricsRegistry implements the Config interface for ConfigLocal.
func (*ConfigLocal) Notifier ¶
func (c *ConfigLocal) Notifier() Notifier
Notifier implements the Config interface for ConfigLocal.
func (*ConfigLocal) QuotaReclamationMinUnrefAge ¶
func (c *ConfigLocal) QuotaReclamationMinUnrefAge() time.Duration
QuotaReclamationMinUnrefAge implements the Config interface for ConfigLocal.
func (*ConfigLocal) QuotaReclamationPeriod ¶
func (c *ConfigLocal) QuotaReclamationPeriod() time.Duration
QuotaReclamationPeriod implements the Config interface for ConfigLocal.
func (*ConfigLocal) RekeyQueue ¶
func (c *ConfigLocal) RekeyQueue() RekeyQueue
RekeyQueue implements the Config interface for ConfigLocal.
func (*ConfigLocal) RekeyWithPromptWaitTime ¶
func (c *ConfigLocal) RekeyWithPromptWaitTime() time.Duration
RekeyWithPromptWaitTime implements the Config interface for ConfigLocal.
func (*ConfigLocal) Reporter ¶
func (c *ConfigLocal) Reporter() Reporter
Reporter implements the Config interface for ConfigLocal.
func (*ConfigLocal) ReqsBufSize ¶
func (c *ConfigLocal) ReqsBufSize() int
ReqsBufSize implements the Config interface for ConfigLocal.
func (*ConfigLocal) ResetCaches ¶
func (c *ConfigLocal) ResetCaches()
ResetCaches implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetBlockCache ¶
func (c *ConfigLocal) SetBlockCache(b BlockCache)
SetBlockCache implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetBlockOps ¶
func (c *ConfigLocal) SetBlockOps(b BlockOps)
SetBlockOps implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetBlockServer ¶
func (c *ConfigLocal) SetBlockServer(b BlockServer)
SetBlockServer implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetBlockSplitter ¶
func (c *ConfigLocal) SetBlockSplitter(b BlockSplitter)
SetBlockSplitter implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetClock ¶
func (c *ConfigLocal) SetClock(cl Clock)
SetClock implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetCodec ¶
func (c *ConfigLocal) SetCodec(co Codec)
SetCodec implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetConflictRenamer ¶
func (c *ConfigLocal) SetConflictRenamer(cr ConflictRenamer)
SetConflictRenamer implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetCrypto ¶
func (c *ConfigLocal) SetCrypto(cr Crypto)
SetCrypto implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetDirtyBlockCache ¶
func (c *ConfigLocal) SetDirtyBlockCache(d DirtyBlockCache)
SetDirtyBlockCache implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetDoBackgroundFlushes ¶
func (c *ConfigLocal) SetDoBackgroundFlushes(doBGFlush bool)
SetDoBackgroundFlushes implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetKBFSOps ¶
func (c *ConfigLocal) SetKBFSOps(k KBFSOps)
SetKBFSOps implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetKBPKI ¶
func (c *ConfigLocal) SetKBPKI(k KBPKI)
SetKBPKI implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetKeyCache ¶
func (c *ConfigLocal) SetKeyCache(k KeyCache)
SetKeyCache implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetKeyManager ¶
func (c *ConfigLocal) SetKeyManager(k KeyManager)
SetKeyManager implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetKeyOps ¶
func (c *ConfigLocal) SetKeyOps(k KeyOps)
SetKeyOps implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetKeyServer ¶
func (c *ConfigLocal) SetKeyServer(k KeyServer)
SetKeyServer implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetKeybaseService ¶
func (c *ConfigLocal) SetKeybaseService(k KeybaseService)
SetKeybaseService implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetLoggerMaker ¶
func (c *ConfigLocal) SetLoggerMaker( loggerFn func(module string) logger.Logger)
SetLoggerMaker implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetMDCache ¶
func (c *ConfigLocal) SetMDCache(m MDCache)
SetMDCache implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetMDOps ¶
func (c *ConfigLocal) SetMDOps(m MDOps)
SetMDOps implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetMDServer ¶
func (c *ConfigLocal) SetMDServer(m MDServer)
SetMDServer implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetMetricsRegistry ¶
func (c *ConfigLocal) SetMetricsRegistry(r metrics.Registry)
SetMetricsRegistry implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetNotifier ¶
func (c *ConfigLocal) SetNotifier(n Notifier)
SetNotifier implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetRekeyQueue ¶
func (c *ConfigLocal) SetRekeyQueue(r RekeyQueue)
SetRekeyQueue implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetReporter ¶
func (c *ConfigLocal) SetReporter(r Reporter)
SetReporter implements the Config interface for ConfigLocal.
func (*ConfigLocal) SetTLFValidDuration ¶
func (c *ConfigLocal) SetTLFValidDuration(r time.Duration)
SetTLFValidDuration implements the Config interface for ConfigLocal.
func (*ConfigLocal) Shutdown ¶
func (c *ConfigLocal) Shutdown() error
Shutdown implements the Config interface for ConfigLocal.
func (*ConfigLocal) TLFValidDuration ¶
func (c *ConfigLocal) TLFValidDuration() time.Duration
TLFValidDuration implements the Config interface for ConfigLocal.
type ConflictRenamer ¶
type ConflictRenamer interface {
// ConflictRename returns the appropriately modified filename.
ConflictRename(op op, original string) string
}
ConflictRenamer deals with names for conflicting directory entries.
type ConflictResolver ¶
type ConflictResolver struct {
// contains filtered or unexported fields
}
ConflictResolver is responsible for resolving conflicts in the background.
func NewConflictResolver ¶
func NewConflictResolver( config Config, fbo *folderBranchOps) *ConflictResolver
NewConflictResolver constructs a new ConflictResolver (and launches any necessary background goroutines).
func (*ConflictResolver) Pause ¶
func (cr *ConflictResolver) Pause()
Pause cancels any ongoing resolutions and prevents any new ones from starting.
func (*ConflictResolver) Resolve ¶
func (cr *ConflictResolver) Resolve(unmerged MetadataRevision, merged MetadataRevision)
Resolve takes the latest known unmerged and merged revision numbers, and kicks off the resolution process.
func (*ConflictResolver) Restart ¶
func (cr *ConflictResolver) Restart(baseCtx context.Context)
Restart re-enables conflict resolution, with a base context for CR operations.
func (*ConflictResolver) Shutdown ¶
func (cr *ConflictResolver) Shutdown()
Shutdown cancels any ongoing resolutions and stops any background goroutines.
type Context ¶
type Context interface {
GetRunMode() libkb.RunMode
GetLogDir() string
ConfigureSocketInfo() (err error)
GetSocket(clearError bool) (net.Conn, rpc.Transporter, bool, error)
NewRPCLogFactory() *libkb.RPCLogFactory
}
Context defines the environment for this package
type CryptPrivateKey ¶
type CryptPrivateKey struct {
// contains filtered or unexported fields
}
CryptPrivateKey is a private key for encryption/decryption.
func MakeFakeCryptPrivateKeyOrBust ¶
func MakeFakeCryptPrivateKeyOrBust(seed string) CryptPrivateKey
MakeFakeCryptPrivateKeyOrBust makes a new crypt private key from fake randomness made from the given seed.
func MakeLocalUserCryptPrivateKeyOrBust ¶
func MakeLocalUserCryptPrivateKeyOrBust(name libkb.NormalizedUsername) CryptPrivateKey
MakeLocalUserCryptPrivateKeyOrBust returns a unique private encryption key for this user.
type CryptPrivateKeySecret ¶
type CryptPrivateKeySecret struct {
// contains filtered or unexported fields
}
CryptPrivateKeySecret is a secret that can be used to construct a CryptPrivateKey.
type CryptPublicKey ¶
type CryptPublicKey struct {
// contains filtered or unexported fields
}
CryptPublicKey (M_u^i) is used (with a TLFEphemeralPrivateKey) to encrypt TLFCryptKeyClientHalf objects (t_u^{f,0,i}) for non-public directories. (See 4.1.1.) These are also sometimes known as subkeys.
Copies of CryptPublicKey objects are deep copies.
func MakeCryptPublicKey ¶
func MakeCryptPublicKey(kid keybase1.KID) CryptPublicKey
MakeCryptPublicKey returns a CryptPublicKey containing the given KID.
func MakeFakeCryptPublicKeyOrBust ¶
func MakeFakeCryptPublicKeyOrBust(seed string) CryptPublicKey
MakeFakeCryptPublicKeyOrBust makes the public key corresponding to the crypt private key made with the same seed.
func MakeLocalUserCryptPublicKeyOrBust ¶
func MakeLocalUserCryptPublicKeyOrBust(name libkb.NormalizedUsername) CryptPublicKey
MakeLocalUserCryptPublicKeyOrBust returns the public key corresponding to the crypt private key for this user.
func (CryptPublicKey) KID ¶
func (k CryptPublicKey) KID() keybase1.KID
Needed by mdserver/server_test.go. TODO: Figure out how to avoid this.
func (CryptPublicKey) MarshalBinary ¶
func (*CryptPublicKey) UnmarshalBinary ¶
type Crypto ¶
type Crypto interface {
// DecryptTLFCryptKeyClientHalf decrypts a TLFCryptKeyClientHalf
// using the current device's private key and the TLF's ephemeral
// public key.
DecryptTLFCryptKeyClientHalf(ctx context.Context,
publicKey TLFEphemeralPublicKey,
encryptedClientHalf EncryptedTLFCryptKeyClientHalf) (
TLFCryptKeyClientHalf, error)
// DecryptTLFCryptKeyClientHalfAny decrypts one of the
// TLFCryptKeyClientHalf using the available private keys and the
// ephemeral public key. If promptPaper is true, the service will
// prompt the user for any unlocked paper keys.
DecryptTLFCryptKeyClientHalfAny(ctx context.Context,
keys []EncryptedTLFCryptKeyClientAndEphemeral, promptPaper bool) (
TLFCryptKeyClientHalf, int, error)
// Shutdown frees any resources associated with this instance.
Shutdown()
// contains filtered or unexported methods
}
Crypto signs, verifies, encrypts, and decrypts stuff.
type CryptoClient ¶
type CryptoClient struct {
CryptoCommon
// contains filtered or unexported fields
}
CryptoClient is a keybase1.CryptoInterface based implementation for Crypto.
func NewCryptoClient ¶
func NewCryptoClient(config Config, client keybase1.CryptoInterface, log logger.Logger) *CryptoClient
NewCryptoClient constructs a crypto client for a keybase1.CryptoInterface.
func (*CryptoClient) DecryptTLFCryptKeyClientHalf ¶
func (c *CryptoClient) DecryptTLFCryptKeyClientHalf(ctx context.Context, publicKey TLFEphemeralPublicKey, encryptedClientHalf EncryptedTLFCryptKeyClientHalf) ( clientHalf TLFCryptKeyClientHalf, err error)
DecryptTLFCryptKeyClientHalf implements the Crypto interface for CryptoClient.
func (*CryptoClient) DecryptTLFCryptKeyClientHalfAny ¶
func (c *CryptoClient) DecryptTLFCryptKeyClientHalfAny(ctx context.Context, keys []EncryptedTLFCryptKeyClientAndEphemeral, promptPaper bool) ( clientHalf TLFCryptKeyClientHalf, index int, err error)
DecryptTLFCryptKeyClientHalfAny implements the Crypto interface for CryptoClient.
func (*CryptoClient) Shutdown ¶
func (c *CryptoClient) Shutdown()
Shutdown implements the Crypto interface for CryptoClient.
func (*CryptoClient) Sign ¶
func (c *CryptoClient) Sign(ctx context.Context, msg []byte) ( sigInfo SignatureInfo, err error)
Sign implements the Crypto interface for CryptoClient.
func (*CryptoClient) SignToString ¶
SignToString implements the Crypto interface for CryptoClient.
type CryptoClientRPC ¶
type CryptoClientRPC struct {
CryptoClient
}
CryptoClientRPC is an RPC based implementation for Crypto.
func NewCryptoClientRPC ¶
func NewCryptoClientRPC(config Config, kbCtx Context) *CryptoClientRPC
NewCryptoClientRPC constructs a new RPC based Crypto implementation.
func (CryptoClientRPC) HandlerName ¶
func (CryptoClientRPC) HandlerName() string
HandlerName implements the ConnectionHandler interface.
func (*CryptoClientRPC) OnConnect ¶
func (c *CryptoClientRPC) OnConnect(ctx context.Context, conn *rpc.Connection, _ rpc.GenericClient, server *rpc.Server) error
OnConnect implements the ConnectionHandler interface.
func (*CryptoClientRPC) OnConnectError ¶
func (c *CryptoClientRPC) OnConnectError(err error, wait time.Duration)
OnConnectError implements the ConnectionHandler interface.
func (*CryptoClientRPC) OnDisconnected ¶
func (c *CryptoClientRPC) OnDisconnected(_ context.Context, status rpc.DisconnectStatus)
OnDisconnected implements the ConnectionHandler interface.
func (*CryptoClientRPC) OnDoCommandError ¶
func (c *CryptoClientRPC) OnDoCommandError(err error, wait time.Duration)
OnDoCommandError implements the ConnectionHandler interface.
func (*CryptoClientRPC) ShouldRetry ¶
func (c *CryptoClientRPC) ShouldRetry(rpcName string, err error) bool
ShouldRetry implements the ConnectionHandler interface.
func (*CryptoClientRPC) ShouldRetryOnConnect ¶
func (c *CryptoClientRPC) ShouldRetryOnConnect(err error) bool
ShouldRetryOnConnect implements the ConnectionHandler interface.
type CryptoCommon ¶
type CryptoCommon struct {
// contains filtered or unexported fields
}
CryptoCommon contains many of the function implementations need for the Crypto interface, which can be reused by other implementations.
func MakeCryptoCommon ¶
func MakeCryptoCommon(codec Codec) CryptoCommon
MakeCryptoCommon returns a default CryptoCommon object.
func (CryptoCommon) DecryptBlock ¶
func (c CryptoCommon) DecryptBlock(encryptedBlock EncryptedBlock, key BlockCryptKey, block Block) error
DecryptBlock implements the Crypto interface for CryptoCommon.
func (CryptoCommon) DecryptMerkleLeaf ¶
func (c CryptoCommon) DecryptMerkleLeaf(encryptedLeaf EncryptedMerkleLeaf, privKey TLFPrivateKey, nonce *[24]byte, ePubKey TLFEphemeralPublicKey) (*MerkleLeaf, error)
DecryptMerkleLeaf decrypts a Merkle leaf node with the TLFPrivateKey.
func (CryptoCommon) DecryptPrivateMetadata ¶
func (c CryptoCommon) DecryptPrivateMetadata(encryptedPmd EncryptedPrivateMetadata, key TLFCryptKey) (*PrivateMetadata, error)
DecryptPrivateMetadata implements the Crypto interface for CryptoCommon.
func (CryptoCommon) EncryptBlock ¶
func (c CryptoCommon) EncryptBlock(block Block, key BlockCryptKey) (plainSize int, encryptedBlock EncryptedBlock, err error)
EncryptBlock implements the Crypto interface for CryptoCommon.
func (CryptoCommon) EncryptMerkleLeaf ¶
func (c CryptoCommon) EncryptMerkleLeaf(leaf MerkleLeaf, pubKey TLFPublicKey, nonce *[24]byte, ePrivKey TLFEphemeralPrivateKey) (EncryptedMerkleLeaf, error)
EncryptMerkleLeaf encrypts a Merkle leaf node with the TLFPublicKey.
func (CryptoCommon) EncryptPrivateMetadata ¶
func (c CryptoCommon) EncryptPrivateMetadata(pmd *PrivateMetadata, key TLFCryptKey) (encryptedPmd EncryptedPrivateMetadata, err error)
EncryptPrivateMetadata implements the Crypto interface for CryptoCommon.
func (CryptoCommon) EncryptTLFCryptKeyClientHalf ¶
func (c CryptoCommon) EncryptTLFCryptKeyClientHalf(privateKey TLFEphemeralPrivateKey, publicKey CryptPublicKey, clientHalf TLFCryptKeyClientHalf) (encryptedClientHalf EncryptedTLFCryptKeyClientHalf, err error)
EncryptTLFCryptKeyClientHalf implements the Crypto interface for CryptoCommon.
func (CryptoCommon) GetTLFCryptKeyServerHalfID ¶
func (c CryptoCommon) GetTLFCryptKeyServerHalfID( user keybase1.UID, deviceKID keybase1.KID, serverHalf TLFCryptKeyServerHalf) (TLFCryptKeyServerHalfID, error)
GetTLFCryptKeyServerHalfID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeBlockRefNonce ¶
func (c CryptoCommon) MakeBlockRefNonce() (nonce BlockRefNonce, err error)
MakeBlockRefNonce implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeMdID ¶
func (c CryptoCommon) MakeMdID(md BareRootMetadata) (MdID, error)
MakeMdID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeMerkleHash ¶
func (c CryptoCommon) MakeMerkleHash(md *RootMetadataSigned) (MerkleHash, error)
MakeMerkleHash implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakePermanentBlockID ¶
func (c CryptoCommon) MakePermanentBlockID(encodedEncryptedData []byte) (BlockID, error)
MakePermanentBlockID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeRandomBlockCryptKeyServerHalf ¶
func (c CryptoCommon) MakeRandomBlockCryptKeyServerHalf() (serverHalf BlockCryptKeyServerHalf, err error)
MakeRandomBlockCryptKeyServerHalf implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeRandomBranchID ¶
func (c CryptoCommon) MakeRandomBranchID() (BranchID, error)
MakeRandomBranchID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeRandomTLFCryptKeyServerHalf ¶
func (c CryptoCommon) MakeRandomTLFCryptKeyServerHalf() (serverHalf TLFCryptKeyServerHalf, err error)
MakeRandomTLFCryptKeyServerHalf implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeRandomTLFKeys ¶
func (c CryptoCommon) MakeRandomTLFKeys() ( tlfPublicKey TLFPublicKey, tlfPrivateKey TLFPrivateKey, tlfEphemeralPublicKey TLFEphemeralPublicKey, tlfEphemeralPrivateKey TLFEphemeralPrivateKey, tlfCryptKey TLFCryptKey, err error)
MakeRandomTLFKeys implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeRandomTlfID ¶
func (c CryptoCommon) MakeRandomTlfID(isPublic bool) (TlfID, error)
MakeRandomTlfID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeTemporaryBlockID ¶
func (c CryptoCommon) MakeTemporaryBlockID() (BlockID, error)
MakeTemporaryBlockID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MaskTLFCryptKey ¶
func (c CryptoCommon) MaskTLFCryptKey(serverHalf TLFCryptKeyServerHalf, key TLFCryptKey) (clientHalf TLFCryptKeyClientHalf, err error)
MaskTLFCryptKey implements the Crypto interface for CryptoCommon.
func (CryptoCommon) UnmaskBlockCryptKey ¶
func (c CryptoCommon) UnmaskBlockCryptKey(serverHalf BlockCryptKeyServerHalf, tlfCryptKey TLFCryptKey) (key BlockCryptKey, error error)
UnmaskBlockCryptKey implements the Crypto interface for CryptoCommon.
func (CryptoCommon) UnmaskTLFCryptKey ¶
func (c CryptoCommon) UnmaskTLFCryptKey(serverHalf TLFCryptKeyServerHalf, clientHalf TLFCryptKeyClientHalf) (key TLFCryptKey, err error)
UnmaskTLFCryptKey implements the Crypto interface for CryptoCommon.
func (CryptoCommon) Verify ¶
func (c CryptoCommon) Verify(msg []byte, sigInfo SignatureInfo) (err error)
Verify implements the Crypto interface for CryptoCommon.
func (CryptoCommon) VerifyBlockID ¶
func (c CryptoCommon) VerifyBlockID(encodedEncryptedData []byte, id BlockID) error
VerifyBlockID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) VerifyTLFCryptKeyServerHalfID ¶
func (c CryptoCommon) VerifyTLFCryptKeyServerHalfID(serverHalfID TLFCryptKeyServerHalfID, user keybase1.UID, deviceKID keybase1.KID, serverHalf TLFCryptKeyServerHalf) error
VerifyTLFCryptKeyServerHalfID implements the Crypto interface for CryptoCommon.
type CryptoLocal ¶
type CryptoLocal struct {
CryptoCommon
// contains filtered or unexported fields
}
CryptoLocal implements the Crypto interface by using a local signing key and a local crypt private key.
func NewCryptoLocal ¶
func NewCryptoLocal(config Config, signingKey SigningKey, cryptPrivateKey CryptPrivateKey) CryptoLocal
NewCryptoLocal constructs a new CryptoLocal instance with the given signing key.
func (CryptoLocal) DecryptTLFCryptKeyClientHalf ¶
func (c CryptoLocal) DecryptTLFCryptKeyClientHalf(ctx context.Context, publicKey TLFEphemeralPublicKey, encryptedClientHalf EncryptedTLFCryptKeyClientHalf) ( clientHalf TLFCryptKeyClientHalf, err error)
DecryptTLFCryptKeyClientHalf implements the Crypto interface for CryptoLocal.
func (CryptoLocal) DecryptTLFCryptKeyClientHalfAny ¶
func (c CryptoLocal) DecryptTLFCryptKeyClientHalfAny(ctx context.Context, keys []EncryptedTLFCryptKeyClientAndEphemeral, _ bool) ( clientHalf TLFCryptKeyClientHalf, index int, err error)
DecryptTLFCryptKeyClientHalfAny implements the Crypto interface for CryptoLocal.
func (CryptoLocal) Shutdown ¶
func (c CryptoLocal) Shutdown()
Shutdown implements the Crypto interface for CryptoLocal.
type CryptoMeasured ¶
type CryptoMeasured struct {
Crypto
// contains filtered or unexported fields
}
CryptoMeasured delegates to another Crypto instance but also keeps track of (some) stats.
func NewCryptoMeasured ¶
func NewCryptoMeasured(delegate Crypto, r metrics.Registry) CryptoMeasured
NewCryptoMeasured creates and returns a new CryptoMeasured instance with the given delegate and registry.
func (CryptoMeasured) MakeMdID ¶
func (c CryptoMeasured) MakeMdID(md BareRootMetadata) (mdID MdID, err error)
MakeMdID implements the Crypto interface for CryptoMeasured.
type CtxCRTagKey ¶
type CtxCRTagKey int
CtxCRTagKey is the type used for unique context tags related to conflict resolution
const ( // CtxCRIDKey is the type of the tag for unique operation IDs // related to conflict resolution CtxCRIDKey CtxCRTagKey = iota )
type CtxFBMTagKey ¶
type CtxFBMTagKey int
CtxFBMTagKey is the type used for unique context tags within folderBlockManager
const ( // CtxFBMIDKey is the type of the tag for unique operation IDs // within folderBlockManager. CtxFBMIDKey CtxFBMTagKey = iota )
type CtxFBOTagKey ¶
type CtxFBOTagKey int
CtxFBOTagKey is the type used for unique context tags within folderBranchOps
const ( // CtxFBOIDKey is the type of the tag for unique operation IDs // within folderBranchOps. CtxFBOIDKey CtxFBOTagKey = iota )
type CtxKeybaseServiceTagKey ¶
type CtxKeybaseServiceTagKey int
CtxKeybaseServiceTagKey is the type used for unique context tags used while servicing incoming keybase requests.
const ( // CtxKeybaseServiceIDKey is the type of the tag for unique // operation IDs used while servicing incoming keybase requests. CtxKeybaseServiceIDKey CtxKeybaseServiceTagKey = iota )
type CtxMDSRTagKey ¶
type CtxMDSRTagKey int
CtxMDSRTagKey is the type used for unique context tags within MDServerRemote
const ( // CtxMDSRIDKey is the type of the tag for unique operation IDs // within MDServerRemote. CtxMDSRIDKey CtxMDSRTagKey = iota )
type CtxRekeyTagKey ¶
type CtxRekeyTagKey int
CtxRekeyTagKey is the type used for unique context tags within an enqueued Rekey.
const ( // CtxRekeyIDKey is the type of the tag for unique operation IDs // within an enqueued Rekey. CtxRekeyIDKey CtxRekeyTagKey = iota )
type DataVer ¶
type DataVer int
DataVer is the type of a version for marshalled KBFS data structures.
func DefaultNewBlockDataVersion ¶
DefaultNewBlockDataVersion returns the default data version for new blocks.
type DeviceKeyInfoMap ¶
type DeviceKeyInfoMap map[keybase1.KID]TLFCryptKeyInfo
DeviceKeyInfoMap is a map from a user devices (identified by the KID of the corresponding device CryptPublicKey) to the TLF's symmetric secret key information.
type DirBlock ¶
type DirBlock struct {
CommonBlock
// if not indirect, a map of path name to directory entry
Children map[string]DirEntry `codec:"c,omitempty"`
// if indirect, contains the indirect pointers to the next level of blocks
IPtrs []IndirectDirPtr `codec:"i,omitempty"`
}
DirBlock is the contents of a directory
type DirEntry ¶
type DirEntry struct {
BlockInfo
EntryInfo
codec.UnknownFieldSetHandler
}
DirEntry is all the data info a directory know about its child.
func (*DirEntry) IsInitialized ¶
IsInitialized returns true if this DirEntry has been initialized.
type DirNotEmptyError ¶
type DirNotEmptyError struct {
Name string
}
DirNotEmptyError indicates that the user tried to unlink a subdirectory that was not empty.
func (DirNotEmptyError) Errno ¶
func (e DirNotEmptyError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for DirNotEmptyError
func (DirNotEmptyError) Error ¶
func (e DirNotEmptyError) Error() string
Error implements the error interface for DirNotEmptyError
type DirTooBigError ¶
type DirTooBigError struct {
// contains filtered or unexported fields
}
DirTooBigError indicates that the user tried to write a directory that would be bigger than KBFS's supported size.
func (DirTooBigError) Errno ¶
func (e DirTooBigError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for DirTooBigError.
func (DirTooBigError) Error ¶
func (e DirTooBigError) Error() string
Error implements the error interface for DirTooBigError.
type DirtyBlockCache ¶
type DirtyBlockCache interface {
// Get gets the block associated with the given block ID. Returns
// the dirty block for the given ID, if one exists.
Get(ptr BlockPointer, branch BranchName) (Block, error)
// Put stores a dirty block currently identified by the
// given block pointer and branch name.
Put(ptr BlockPointer, branch BranchName, block Block) error
// Delete removes the dirty block associated with the given block
// pointer and branch from the cache. No error is returned if no
// block exists for the given ID.
Delete(ptr BlockPointer, branch BranchName) error
// IsDirty states whether or not the block associated with the
// given block pointer and branch name is dirty in this cache.
IsDirty(ptr BlockPointer, branch BranchName) bool
// RequestPermissionToDirty is called whenever a user wants to
// write data to a file. The caller provides an estimated number
// of bytes that will become dirty -- this is difficult to know
// exactly without pre-fetching all the blocks involved, but in
// practice we can just use the number of bytes sent in via the
// Write. It returns a channel that blocks until the cache is
// ready to receive more dirty data, at which point the channel is
// closed. The user must call
// `UpdateUnsyncedBytes(-estimatedDirtyBytes)` once it has
// completed its write and called `UpdateUnsyncedBytes` for all
// the exact dirty block sizes.
RequestPermissionToDirty(ctx context.Context,
estimatedDirtyBytes int64) (DirtyPermChan, error)
// UpdateUnsyncedBytes is called by a user, who has already been
// granted permission to write, with the delta in block sizes that
// were dirtied as part of the write. So for example, if a
// newly-dirtied block of 20 bytes was extended by 5 bytes, they
// should send 25. If on the next write (before any syncs), bytes
// 10-15 of that same block were overwritten, they should send 0
// over the channel because there were no new bytes. If an
// already-dirtied block is truncated, or if previously requested
// bytes have now been updated more accurately in previous
// requests, newUnsyncedBytes may be negative. wasSyncing should
// be true if `BlockSyncStarted` has already been called for this
// block.
UpdateUnsyncedBytes(newUnsyncedBytes int64, wasSyncing bool)
// UpdateSyncingBytes is called when a particular block has
// started syncing, or with a negative number when a block is no
// longer syncing due to an error (and BlockSyncFinished will
// never be called).
UpdateSyncingBytes(size int64)
// BlockSyncFinished is called when a particular block has
// finished syncing, though the overall sync might not yet be
// complete. This lets the cache know it might be able to grant
// more permission to writers.
BlockSyncFinished(size int64)
// SyncFinished is called when a complete sync has completed and
// its dirty blocks have been removed from the cache. This lets
// the cache know it might be able to grant more permission to
// writers.
SyncFinished(size int64)
// ShouldForceSync returns true if the sync buffer is full enough
// to force all callers to sync their data immediately.
ShouldForceSync() bool
// Shutdown frees any resources associated with this instance. It
// returns an error if there are any unsynced blocks.
Shutdown() error
}
DirtyBlockCache gets and puts plaintext dir blocks and file blocks into a cache, which have been modified by the application and not yet committed on the KBFS servers. They are identified by a (potentially random) ID that may not have any relationship with their context, along with a Branch in case the same TLF is being modified via multiple branches. Dirty blocks are never evicted, they must be deleted explicitly.
type DirtyBlockCacheStandard ¶
type DirtyBlockCacheStandard struct {
// contains filtered or unexported fields
}
DirtyBlockCacheStandard implements the DirtyBlockCache interface by storing blocks in an in-memory cache. Dirty blocks are identified by their block ID, branch name, and reference nonce, since the same block may be forked and modified on different branches and under different references simultaneously.
DirtyBlockCacheStandard controls how fast uses can write into KBFS, and does so with a TCP-like slow-start algorithm that adjusts itself according to how fast bytes are synced to the server. Conceptually, there are two buffers:
syncBuf: The bytes that are currently syncing, or have finished syncing, back to the servers. Each TLF has only one sync at a time, but multiple TLFs may be syncing at the same time. We also track how many bytes within this buffer have finished syncing. waitBuf: The bytes that have not yet begun syncing to the servers. Again, this can be for multiple TLFs, and from multiple files within a TLF. In the TCP analogy, think of this as the congestion window (cwnd).
The goal is to make sure that syncBuf can always be transmitted to the server within the file system operation timeout forced on us by the layer that interacts with the file system (19 seconds on OS X and Windows, defaults to 30 seconds for other layers if not already set). In fact, ideally the data would be transmitted in HALF of the file system operation timeout, in case a user Sync operation gets blocked behind a background Sync operation when there is significant data in waitBuf. At the same time, we want it to be as big as possible, because we get the best performance when writing lots of blocks in parallel to the servers. So, we want an algorithm that allows waitBuf to grow, without causing the next sync (or write, or setattr, etc) operation to timeout. For the purposes of this discussion, let's assume there is only one active TLF at a time.
We allow the user to set a min, start, and max size for waitBuf. Whenever a sync starts, bytes are transferred from waitBuf into syncBuf and a timer is started. When a sync completes successfully, the number of bytes synced is added to the allowed size of waitBuf (i.e., "additive increase" == exponential growth). However, if the number of sync'd bytes is smaller than the min waitBuf size, we don't do additive increase (because we haven't really tested the throughput of the server connection in that case).
If the sync takes more than 33% of half the overall operation timeout, the size of waitBuf is reduced by that same percentage (i.e., "multiplicative decrease"), and any outstanding bytes in the sync will not be used in the "additive increase" phase when the sync completes (they are considered "lost" in the TCP analogy, even though they should eventually succeed). The 33% limit was chosen mostly by trial and error, although if you assume that capacity(waitBuf) will double after each sync, then `2*len(syncBuf) == capacity(waitBuf)`, so at any given point there can be about 3*capacity(syncBuf) bytes buffered; so if syncBuf can't be sync'd in a third of the overall timeout, the next waitBuf should be reduced.
Finally, we need to make sure that the Write calls that are filling up waitBuf while a sync is happening don't timeout. But, we also need to fill waitBuf quickly, so that the next sync is ready to go as soon as the first one completes. Here we implement a compromise. Allow waitBuf to fill up instantly until it holds capacity(syncBuf) bytes. After that, allow it to fill up to 2*capacity(syncBuf), but artificially delay each write by adding backpressure, by some fraction of the system operation timeout that matches the fraction of the progress the buffer has made between capacity(syncBuf) and 2*capacity(syncBuf). As soon as the sync completes, any delayed write is unblocked and gets to start filling up the buffers again.
func NewDirtyBlockCacheStandard ¶
func NewDirtyBlockCacheStandard(clock Clock, makeLog func(string) logger.Logger, minSyncBufCap int64, maxSyncBufCap int64, startSyncBufCap int64) *DirtyBlockCacheStandard
NewDirtyBlockCacheStandard constructs a new BlockCacheStandard instance. makeLog is a function that will be called later to make a log (we don't take an actual log, to allow the DirtyBlockCache to be created before logging is initialized). The min and max buffer capacities define the possible range of how many bytes we'll try to sync in any one sync, and the start size defines the initial buffer size.
func (*DirtyBlockCacheStandard) BlockSyncFinished ¶
func (d *DirtyBlockCacheStandard) BlockSyncFinished(size int64)
BlockSyncFinished implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) Delete ¶
func (d *DirtyBlockCacheStandard) Delete(ptr BlockPointer, branch BranchName) error
Delete implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) Get ¶
func (d *DirtyBlockCacheStandard) Get(ptr BlockPointer, branch BranchName) ( Block, error)
Get implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) IsDirty ¶
func (d *DirtyBlockCacheStandard) IsDirty( ptr BlockPointer, branch BranchName) (isDirty bool)
IsDirty implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) Put ¶
func (d *DirtyBlockCacheStandard) Put(ptr BlockPointer, branch BranchName, block Block) error
Put implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) RequestPermissionToDirty ¶
func (d *DirtyBlockCacheStandard) RequestPermissionToDirty( ctx context.Context, estimatedDirtyBytes int64) (DirtyPermChan, error)
RequestPermissionToDirty implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) ShouldForceSync ¶
func (d *DirtyBlockCacheStandard) ShouldForceSync() bool
ShouldForceSync implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) Shutdown ¶
func (d *DirtyBlockCacheStandard) Shutdown() error
Shutdown implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) SyncFinished ¶
func (d *DirtyBlockCacheStandard) SyncFinished(size int64)
SyncFinished implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) UpdateSyncingBytes ¶
func (d *DirtyBlockCacheStandard) UpdateSyncingBytes(size int64)
UpdateSyncingBytes implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) UpdateUnsyncedBytes ¶
func (d *DirtyBlockCacheStandard) UpdateUnsyncedBytes(newUnsyncedBytes int64, wasSyncing bool)
UpdateUnsyncedBytes implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
type DirtyPermChan ¶
type DirtyPermChan <-chan struct{}
DirtyPermChan is a channel that gets closed when the holder has permission to write. We are forced to define it as a type due to a bug in mockgen that can't handle return values with a chan struct{}.
type DisallowedPrefixError ¶
type DisallowedPrefixError struct {
// contains filtered or unexported fields
}
DisallowedPrefixError indicates that the user attempted to create an entry using a name with a disallowed prefix.
func (DisallowedPrefixError) Errno ¶
func (e DisallowedPrefixError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for DisallowedPrefixError.
func (DisallowedPrefixError) Error ¶
func (e DisallowedPrefixError) Error() string
Error implements the error interface for NoChainFoundError.
type EmptyNameError ¶
type EmptyNameError struct {
// contains filtered or unexported fields
}
EmptyNameError indicates that the user tried to use an empty name for the given blockRef.
func (EmptyNameError) Error ¶
func (e EmptyNameError) Error() string
Error implements the error interface for EmptyNameError.
type EncryptedMerkleLeaf ¶
type EncryptedMerkleLeaf struct {
Version EncryptionVer
EncryptedData []byte
// contains filtered or unexported fields
}
EncryptedMerkleLeaf is an encrypted Merkle leaf.
type EncryptedPrivateMetadata ¶
type EncryptedPrivateMetadata encryptedData
EncryptedPrivateMetadata is an encrypted PrivateMetadata object.
type EncryptedTLFCryptKeyClientAndEphemeral ¶
type EncryptedTLFCryptKeyClientAndEphemeral struct {
// PublicKey contains the wrapped Key ID of the public key
PubKey CryptPublicKey
// ClientHalf contains the encrypted client half of the TLF key
ClientHalf EncryptedTLFCryptKeyClientHalf
// EPubKey contains the ephemeral public key used to encrypt ClientHalf
EPubKey TLFEphemeralPublicKey
}
EncryptedTLFCryptKeyClientAndEphemeral has what's needed to request a client half decryption.
type EncryptedTLFCryptKeyClientHalf ¶
type EncryptedTLFCryptKeyClientHalf encryptedData
EncryptedTLFCryptKeyClientHalf is an encrypted TLFCryptKeyCLientHalf object.
type EncryptionVer ¶
type EncryptionVer int
EncryptionVer denotes a version for the encryption method.
const ( // EncryptionSecretbox is the encryption version that uses // nacl/secretbox or nacl/box. EncryptionSecretbox EncryptionVer = 1 )
type EntryInfo ¶
type EntryInfo struct {
Type EntryType
Size uint64
SymPath string `codec:",omitempty"` // must be within the same root dir
// Mtime is in unix nanoseconds
Mtime int64
// Ctime is in unix nanoseconds
Ctime int64
}
EntryInfo is the (non-block-related) info a directory knows about its child.
NOTE: Don't add or modify anything in this struct without considering how old clients will handle them (since this is embedded in DirEntry).
type ErrorFileAccessError ¶
type ErrorFileAccessError struct {
}
ErrorFileAccessError indicates that the user tried to perform an operation on the ErrorFile that is not allowed.
func (ErrorFileAccessError) Error ¶
func (e ErrorFileAccessError) Error() string
Error implements the error interface for ErrorFileAccessError
type ErrorModeType ¶
type ErrorModeType int
ErrorModeType indicates what type of operation was being attempted when an error was reported.
const ( // ReadMode indicates that an error happened while trying to read. ReadMode ErrorModeType = iota // WriteMode indicates that an error happened while trying to write. WriteMode )
type ExclOnUnmergedError ¶
type ExclOnUnmergedError struct {
}
ExclOnUnmergedError happens when an operation with O_EXCL set when fbo is on an unmerged local revision
func (ExclOnUnmergedError) Error ¶
func (e ExclOnUnmergedError) Error() string
Error implements the error interface for ExclOnUnmergedError.
type Favorite ¶
Favorite is a top-level favorited folder name.
func NewFavoriteFromFolder ¶
NewFavoriteFromFolder creates a Favorite from a keybase1.Folder.
type Favorites ¶
type Favorites struct {
// contains filtered or unexported fields
}
Favorites manages a user's favorite list.
func NewFavorites ¶
NewFavorites constructs a new Favorites instance.
func (*Favorites) AddAsync ¶
AddAsync initiates a request to add this favorite to your favorites list, if one is not already in flight, but it doesn't wait for the result. (It could block while kicking off the request, if lots of different favorite operations are in flight.) The given context is used only for enqueuing the request on an internal queue, not for any resulting I/O.
func (*Favorites) Get ¶
Get returns the logged-in users list of favorites. It doesn't use the cache.
func (*Favorites) RefreshCache ¶
RefreshCache refreshes the cached list of favorites.
type FileBlock ¶
type FileBlock struct {
CommonBlock
// if not indirect, the full contents of this block
Contents []byte `codec:"c,omitempty"`
// if indirect, contains the indirect pointers to the next level of blocks
IPtrs []IndirectFilePtr `codec:"i,omitempty"`
// contains filtered or unexported fields
}
FileBlock is the contents of a file
func (*FileBlock) DataVersion ¶
DataVersion returns data version for this block.
type FileTooBigError ¶
type FileTooBigError struct {
// contains filtered or unexported fields
}
FileTooBigError indicates that the user tried to write a file that would be bigger than KBFS's supported size.
func (FileTooBigError) Errno ¶
func (e FileTooBigError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for FileTooBigError.
func (FileTooBigError) Error ¶
func (e FileTooBigError) Error() string
Error implements the error interface for FileTooBigError.
type FolderBranch ¶
type FolderBranch struct {
Tlf TlfID
Branch BranchName // master branch, by default
}
FolderBranch represents a unique pair of top-level folder and a branch of that folder.
func (FolderBranch) String ¶
func (fb FolderBranch) String() string
type FolderBranchStatus ¶
type FolderBranchStatus struct {
Staged bool
HeadWriter libkb.NormalizedUsername
DiskUsage uint64
RekeyPending bool
FolderID string
Revision MetadataRevision
// DirtyPaths are files that have been written, but not flushed.
// They do not represent unstaged changes in your local instance.
DirtyPaths []string
// If we're in the staged state, these summaries show the
// diverging operations per-file
Unmerged []*crChainSummary
Merged []*crChainSummary
Journal *TLFJournalStatus `json:",omitempty"`
}
FolderBranchStatus is a simple data structure describing the current status of a particular folder-branch. It is suitable for encoding directly as JSON.
type HMAC ¶
type HMAC struct {
// contains filtered or unexported fields
}
HMAC is the type of a keybase hash that is an HMAC.
All the constants for Hash also apply to HMAC.
func DefaultHMAC ¶
DefaultHMAC computes the HMAC with the given key of the given data using the default hash.
func (HMAC) IsValid ¶
IsValid returns whether the HMAC is valid. Note that an HMAC with an unknown version is still valid.
func (HMAC) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for HMAC. Returns an error if the HMAC is invalid and not the zero HMAC.
func (*HMAC) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for HMAC. Returns an error if the given byte array is non-empty and the HMAC is invalid.
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
Hash is the type of a keybase hash.
func DefaultHash ¶
DefaultHash computes the hash of the given data with the default hash type.
func HashFromBytes ¶
HashFromBytes creates a hash from the given byte array. If the returned error is nil, the returned Hash is valid.
func HashFromRaw ¶
HashFromRaw creates a hash from a type and raw hash data. If the returned error is nil, the returned Hash is valid.
func HashFromString ¶
HashFromString creates a hash from the given string. If the returned error is nil, the returned Hash is valid.
func (Hash) IsValid ¶
IsValid returns whether the hash is valid. Note that a hash with an unknown version is still valid.
func (Hash) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for Hash. Returns an error if the hash is invalid and not the zero hash.
func (*Hash) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Hash. Returns an error if the given byte array is non-empty and the hash is invalid.
type HashMismatchError ¶
HashMismatchError is returned whenever a hash mismatch is detected.
func (HashMismatchError) Error ¶
func (e HashMismatchError) Error() string
type HashType ¶
type HashType byte
HashType is the type of a keybase hash.
const DefaultHashType HashType = SHA256Hash
DefaultHashType is the current default keybase hash type.
type ImmutableBareRootMetadata ¶
type ImmutableBareRootMetadata struct {
BareRootMetadata
// contains filtered or unexported fields
}
ImmutableBareRootMetadata is a thin wrapper around a BareRootMetadata that takes ownership of it and does not ever modify it again. Thus, its MdID can be calculated and stored along with a local timestamp. ImmutableBareRootMetadata objects can be assumed to never alias a (modifiable) BareRootMetadata.
TODO: Move this to bare_root_metadata.go if it's used in more places.
func MakeImmutableBareRootMetadata ¶
func MakeImmutableBareRootMetadata( rmd BareRootMetadata, mdID MdID, localTimestamp time.Time) ImmutableBareRootMetadata
MakeImmutableBareRootMetadata makes a new ImmutableBareRootMetadata from the given BareRootMetadata and its corresponding MdID.
type ImmutableRootMetadata ¶
type ImmutableRootMetadata struct {
ReadOnlyRootMetadata
// contains filtered or unexported fields
}
ImmutableRootMetadata is a thin wrapper around a ReadOnlyRootMetadata that takes ownership of it and does not ever modify it again. Thus, its MdID can be calculated and stored. Unlike ReadOnlyRootMetadata, ImmutableRootMetadata objects can be assumed to never alias a (modifiable) *RootMetadata.
func MakeImmutableRootMetadata ¶
func MakeImmutableRootMetadata( rmd *RootMetadata, mdID MdID, localTimestamp time.Time) ImmutableRootMetadata
MakeImmutableRootMetadata makes a new ImmutableRootMetadata from the given RMD and its corresponding MdID.
func (ImmutableRootMetadata) MdID ¶
func (irmd ImmutableRootMetadata) MdID() MdID
MdID returns the pre-computed MdID of the contained RootMetadata object.
type IncompatibleHandleError ¶
type IncompatibleHandleError struct {
// contains filtered or unexported fields
}
IncompatibleHandleError indicates that somethine tried to update the head of a TLF with a RootMetadata with an incompatible handle.
func (IncompatibleHandleError) Error ¶
func (e IncompatibleHandleError) Error() string
type InconsistentEncodedSizeError ¶
type InconsistentEncodedSizeError struct {
// contains filtered or unexported fields
}
InconsistentEncodedSizeError is raised when a dirty block has a non-zero encoded size.
func (InconsistentEncodedSizeError) Error ¶
func (e InconsistentEncodedSizeError) Error() string
Error implements the error interface for InconsistentEncodedSizeError
type IndirectDirPtr ¶
type IndirectDirPtr struct {
// TODO: Make sure that the block is not dirty when the EncodedSize
// field is non-zero.
BlockInfo
Off string `codec:"o"`
codec.UnknownFieldSetHandler
}
IndirectDirPtr pairs an indirect dir block with the start of that block's range of directory entries (inclusive)
type IndirectFilePtr ¶
type IndirectFilePtr struct {
// When the EncodedSize field is non-zero, the block must not
// be dirty.
BlockInfo
Off int64 `codec:"o"`
// Marker for files with holes
Holes bool `codec:"h,omitempty"`
codec.UnknownFieldSetHandler
}
IndirectFilePtr pairs an indirect file block with the start of that block's range of bytes (inclusive)
type InitParams ¶
type InitParams struct {
// Whether to print debug messages.
Debug bool
// If non-empty, where to write a CPU profile.
CPUProfile string
// If non-empty, the host:port of the block server. If empty,
// a default value is used depending on the run mode.
BServerAddr string
// If non-empty the host:port of the metadata server. If
// empty, a default value is used depending on the run mode.
MDServerAddr string
// If true, use in-memory servers and ignore BServerAddr,
// MDServerAddr, and ServerRootDir.
ServerInMemory bool
// If non-empty, use on-disk servers and ignore BServerAddr
// and MDServerAddr.
ServerRootDir string
// Fake local user name. If non-empty, either ServerInMemory
// must be true or ServerRootDir must be non-empty.
LocalUser string
// TLFValidDuration is the duration that TLFs are valid
// before marked for lazy revalidation.
TLFValidDuration time.Duration
// LogToFile if true, logs to a default file location.
LogToFile bool
// LogFileConfig tells us where to log and rotation config.
LogFileConfig logger.LogFileConfig
// WriteJournalRoot, if non-empty, points to a path to a local
// directory to put write journals in. If non-empty, enables
// write journaling to be turned on for TLFs.
WriteJournalRoot string
}
InitParams contains the initialization parameters for Init(). It is usually filled in by the flags parser passed into AddFlags().
func AddFlags ¶
func AddFlags(flags *flag.FlagSet, ctx Context) *InitParams
AddFlags adds libkbfs flags to the given FlagSet. Returns an InitParams that will be filled in once the given FlagSet is parsed.
func DefaultInitParams ¶
func DefaultInitParams(ctx Context) InitParams
DefaultInitParams returns default init params
type InvalidBlockRefError ¶
type InvalidBlockRefError struct {
// contains filtered or unexported fields
}
InvalidBlockRefError indicates an invalid block reference was encountered.
func (InvalidBlockRefError) Error ¶
func (e InvalidBlockRefError) Error() string
type InvalidBranchID ¶
type InvalidBranchID struct {
// contains filtered or unexported fields
}
InvalidBranchID indicates whether the branch ID string is not parseable or invalid.
func (InvalidBranchID) Error ¶
func (e InvalidBranchID) Error() string
type InvalidByte32DataError ¶
type InvalidByte32DataError struct {
// contains filtered or unexported fields
}
InvalidByte32DataError is returned whenever invalid data for a 32-byte type is detected.
func (InvalidByte32DataError) Error ¶
func (e InvalidByte32DataError) Error() string
type InvalidDataVersionError ¶
type InvalidDataVersionError struct {
DataVer DataVer
}
InvalidDataVersionError indicates that an invalid data version was used.
func (InvalidDataVersionError) Error ¶
func (e InvalidDataVersionError) Error() string
Error implements the error interface for InvalidDataVersionError.
type InvalidHashError ¶
type InvalidHashError struct {
H Hash
}
InvalidHashError is returned whenever an invalid hash is detected.
func (InvalidHashError) Error ¶
func (e InvalidHashError) Error() string
type InvalidKIDError ¶
type InvalidKIDError struct {
// contains filtered or unexported fields
}
InvalidKIDError is returned whenever an invalid KID is detected.
func (InvalidKIDError) Error ¶
func (e InvalidKIDError) Error() string
type InvalidKeyGenerationError ¶
InvalidKeyGenerationError indicates that an invalid key generation was used.
func (InvalidKeyGenerationError) Error ¶
func (e InvalidKeyGenerationError) Error() string
Error implements the error interface for InvalidKeyGenerationError.
type InvalidMetadataVersionError ¶
type InvalidMetadataVersionError struct {
Tlf TlfID
MetadataVer MetadataVer
}
InvalidMetadataVersionError indicates that an invalid metadata version was used.
func (InvalidMetadataVersionError) Error ¶
func (e InvalidMetadataVersionError) Error() string
Error implements the error interface for InvalidMetadataVersionError.
type InvalidNonceError ¶
type InvalidNonceError struct {
// contains filtered or unexported fields
}
InvalidNonceError indicates that an invalid cryptographic nonce was detected.
func (InvalidNonceError) Error ¶
func (e InvalidNonceError) Error() string
Error implements the error interface for InvalidNonceError.
type InvalidOpError ¶
type InvalidOpError struct {
// contains filtered or unexported fields
}
InvalidOpError is returned when an operation is called that isn't supported by the current implementation.
func (InvalidOpError) Error ¶
func (e InvalidOpError) Error() string
type InvalidParentPathError ¶
type InvalidParentPathError struct {
// contains filtered or unexported fields
}
InvalidParentPathError indicates a path without a valid parent was encountered.
func (InvalidParentPathError) Error ¶
func (e InvalidParentPathError) Error() string
Error implements the error interface for InvalidParentPathError.
type InvalidPathError ¶
type InvalidPathError struct {
// contains filtered or unexported fields
}
InvalidPathError indicates an invalid path was encountered.
func (InvalidPathError) Error ¶
func (e InvalidPathError) Error() string
Error implements the error interface for InvalidPathError.
type InvalidPublicTLFOperation ¶
type InvalidPublicTLFOperation struct {
// contains filtered or unexported fields
}
InvalidPublicTLFOperation indicates that an invalid operation was attempted on a public TLF.
func (InvalidPublicTLFOperation) Error ¶
func (e InvalidPublicTLFOperation) Error() string
Error implements the error interface for InvalidPublicTLFOperation.
type InvalidTlfID ¶
type InvalidTlfID struct {
// contains filtered or unexported fields
}
InvalidTlfID indicates whether the TLF ID string is not parseable or invalid.
func (InvalidTlfID) Error ¶
func (e InvalidTlfID) Error() string
type JournalServer ¶
type JournalServer struct {
// contains filtered or unexported fields
}
JournalServer is the server that handles write journals. It interposes itself in front of BlockServer and MDOps. It uses MDOps instead of MDServer because it has to potentially modify the RootMetadata passed in, and by the time it hits MDServer it's already too late. However, this assumes that all MD ops go through MDOps.
func GetJournalServer ¶
func GetJournalServer(config Config) (*JournalServer, error)
GetJournalServer returns the JournalServer tied to a particular config.
func (*JournalServer) Disable ¶
func (j *JournalServer) Disable(ctx context.Context, tlfID TlfID) (err error)
Disable turns off the write journal for the given TLF.
func (*JournalServer) Enable ¶
func (j *JournalServer) Enable(ctx context.Context, tlfID TlfID) (err error)
Enable turns on the write journal for the given TLF.
func (*JournalServer) EnableExistingJournals ¶
func (j *JournalServer) EnableExistingJournals( ctx context.Context) (err error)
EnableExistingJournals turns on the write journal for all TLFs with an existing journal. This must be the first thing done to a JournalServer. Any returned error is fatal, and means that the JournalServer must not be used.
func (*JournalServer) Flush ¶
func (j *JournalServer) Flush(ctx context.Context, tlfID TlfID) (err error)
Flush flushes the write journal for the given TLF.
func (*JournalServer) JournalStatus ¶
func (j *JournalServer) JournalStatus(tlfID TlfID) (TLFJournalStatus, error)
JournalStatus returns a TLFServerStatus object for the given TLF suitable for diagnostics.
func (*JournalServer) Status ¶
func (j *JournalServer) Status() JournalServerStatus
Status returns a JournalServerStatus object suitable for diagnostics.
type JournalServerStatus ¶
JournalServerStatus represents the overall status of the JournalServer for display in diagnostics. It is suitable for encoding directly as JSON.
type KBFSOps ¶
type KBFSOps interface {
// GetFavorites returns the logged-in user's list of favorite
// top-level folders. This is a remote-access operation.
GetFavorites(ctx context.Context) ([]Favorite, error)
// RefreshCachedFavorites tells the instances to forget any cached
// favorites list and fetch a new list from the server. The
// effects are asychronous; if there's an error refreshing the
// favorites, the cached favorites will become empty.
RefreshCachedFavorites(ctx context.Context)
// AddFavorite adds the favorite to both the server and
// the local cache.
AddFavorite(ctx context.Context, fav Favorite) error
// DeleteFavorite deletes the favorite from both the server and
// the local cache. Idempotent, so it succeeds even if the folder
// isn't favorited.
DeleteFavorite(ctx context.Context, fav Favorite) error
// GetTLFCryptKeys gets crypt key of all generations as well as
// TLF ID for tlfHandle. The returned keys (the keys slice) are ordered by
// generation, starting with the key for FirstValidKeyGen.
GetTLFCryptKeys(ctx context.Context, tlfHandle *TlfHandle) (
keys []TLFCryptKey, id TlfID, err error)
// GetOrCreateRootNode returns the root node and root entry
// info associated with the given TLF handle and branch, if
// the logged-in user has read permissions to the top-level
// folder. It creates the folder if one doesn't exist yet (and
// branch == MasterBranch), and the logged-in user has write
// permissions to the top-level folder. This is a
// remote-access operation.
GetOrCreateRootNode(
ctx context.Context, h *TlfHandle, branch BranchName) (
node Node, ei EntryInfo, err error)
// GetRootNode is like GetOrCreateRootNode but if the root node
// does not exist it will return a nil Node and not create it.
GetRootNode(
ctx context.Context, h *TlfHandle, branch BranchName) (
node Node, ei EntryInfo, err error)
// GetDirChildren returns a map of children in the directory,
// mapped to their EntryInfo, if the logged-in user has read
// permission for the top-level folder. This is a remote-access
// operation.
GetDirChildren(ctx context.Context, dir Node) (map[string]EntryInfo, error)
// Lookup returns the Node and entry info associated with a
// given name in a directory, if the logged-in user has read
// permissions to the top-level folder. The returned Node is nil
// if the name is a symlink. This is a remote-access operation.
Lookup(ctx context.Context, dir Node, name string) (Node, EntryInfo, error)
// Stat returns the entry info associated with a
// given Node, if the logged-in user has read permissions to the
// top-level folder. This is a remote-access operation.
Stat(ctx context.Context, node Node) (EntryInfo, error)
// CreateDir creates a new subdirectory under the given node, if
// the logged-in user has write permission to the top-level
// folder. Returns the new Node for the created subdirectory, and
// its new entry info. This is a remote-sync operation.
CreateDir(ctx context.Context, dir Node, name string) (
Node, EntryInfo, error)
// CreateFile creates a new file under the given node, if the
// logged-in user has write permission to the top-level folder.
// Returns the new Node for the created file, and its new
// entry info. excl (when implemented) specifies whether this is an exclusive
// create. Semantically setting excl to WithExcl is like O_CREAT|O_EXCL in a
// Unix open() call.
//
// This is a remote-sync operation.
CreateFile(ctx context.Context, dir Node, name string, isExec bool, excl Excl) (
Node, EntryInfo, error)
// CreateLink creates a new symlink under the given node, if the
// logged-in user has write permission to the top-level folder.
// Returns the new entry info for the created symlink. This
// is a remote-sync operation.
CreateLink(ctx context.Context, dir Node, fromName string, toPath string) (
EntryInfo, error)
// RemoveDir removes the subdirectory represented by the given
// node, if the logged-in user has write permission to the
// top-level folder. Will return an error if the subdirectory is
// not empty. This is a remote-sync operation.
RemoveDir(ctx context.Context, dir Node, dirName string) error
// RemoveEntry removes the directory entry represented by the
// given node, if the logged-in user has write permission to the
// top-level folder. This is a remote-sync operation.
RemoveEntry(ctx context.Context, dir Node, name string) error
// Rename performs an atomic rename operation with a given
// top-level folder if the logged-in user has write permission to
// that folder, and will return an error if nodes from different
// folders are passed in. Also returns an error if the new name
// already has an entry corresponding to an existing directory
// (only non-dir types may be renamed over). This is a
// remote-sync operation.
Rename(ctx context.Context, oldParent Node, oldName string, newParent Node,
newName string) error
// Read fills in the given buffer with data from the file at the
// given node starting at the given offset, if the logged-in user
// has read permission to the top-level folder. The read data
// reflects any outstanding writes and truncates to that file that
// have been written through this KBFSOps object, even if those
// writes have not yet been sync'd. There is no guarantee that
// Read returns all of the requested data; it will return the
// number of bytes that it wrote to the dest buffer. Reads on an
// unlinked file may or may not succeed, depending on whether or
// not the data has been cached locally. If (0, nil) is returned,
// that means EOF has been reached. This is a remote-access
// operation.
Read(ctx context.Context, file Node, dest []byte, off int64) (int64, error)
// Write modifies the file at the given node, by writing the given
// buffer at the given offset within the file, if the logged-in
// user has write permission to the top-level folder. It
// overwrites any data already there, and extends the file size as
// necessary to accomodate the new data. It guarantees to write
// the entire buffer in one operation. Writes on an unlinked file
// may or may not succeed as no-ops, depending on whether or not
// the necessary blocks have been locally cached. This is a
// remote-access operation.
Write(ctx context.Context, file Node, data []byte, off int64) error
// Truncate modifies the file at the given node, by either
// shrinking or extending its size to match the given size, if the
// logged-in user has write permission to the top-level folder.
// If extending the file, it pads the new data with 0s. Truncates
// on an unlinked file may or may not succeed as no-ops, depending
// on whether or not the necessary blocks have been locally
// cached. This is a remote-access operation.
Truncate(ctx context.Context, file Node, size uint64) error
// SetEx turns on or off the executable bit on the file
// represented by a given node, if the logged-in user has write
// permissions to the top-level folder. This is a remote-sync
// operation.
SetEx(ctx context.Context, file Node, ex bool) error
// SetMtime sets the modification time on the file represented by
// a given node, if the logged-in user has write permissions to
// the top-level folder. If mtime is nil, it is a noop. This is
// a remote-sync operation.
SetMtime(ctx context.Context, file Node, mtime *time.Time) error
// Sync flushes all outstanding writes and truncates for the given
// file to the KBFS servers, if the logged-in user has write
// permissions to the top-level folder. If done through a file
// system interface, this may include modifications done via
// multiple file handles. This is a remote-sync operation.
Sync(ctx context.Context, file Node) error
// FolderStatus returns the status of a particular folder/branch, along
// with a channel that will be closed when the status has been
// updated (to eliminate the need for polling this method).
FolderStatus(ctx context.Context, folderBranch FolderBranch) (
FolderBranchStatus, <-chan StatusUpdate, error)
// Status returns the status of KBFS, along with a channel that will be
// closed when the status has been updated (to eliminate the need for
// polling this method). KBFSStatus can be non-empty even if there is an
// error.
Status(ctx context.Context) (
KBFSStatus, <-chan StatusUpdate, error)
// UnstageForTesting clears out this device's staged state, if
// any, and fast-forwards to the current head of this
// folder-branch.
UnstageForTesting(ctx context.Context, folderBranch FolderBranch) error
// Rekey rekeys this folder.
Rekey(ctx context.Context, id TlfID) error
// SyncFromServerForTesting blocks until the local client has
// contacted the server and guaranteed that all known updates
// for the given top-level folder have been applied locally
// (and notifications sent out to any observers). It returns
// an error if this folder-branch is currently unmerged or
// dirty locally.
SyncFromServerForTesting(ctx context.Context, folderBranch FolderBranch) error
// GetUpdateHistory returns a complete history of all the merged
// updates of the given folder, in a data structure that's
// suitable for encoding directly into JSON. This is an expensive
// operation, and should only be used for ocassional debugging.
// Note that the history does not include any unmerged changes or
// outstanding writes from the local device.
GetUpdateHistory(ctx context.Context, folderBranch FolderBranch) (
history TLFUpdateHistory, err error)
// GetEditHistory returns a clustered list of the most recent file
// edits by each of the valid writers of the given folder. users
// looking to get updates to this list can register as an observer
// for the folder.
GetEditHistory(ctx context.Context, folderBranch FolderBranch) (
edits TlfWriterEdits, err error)
// Shutdown is called to clean up any resources associated with
// this KBFSOps instance.
Shutdown() error
// PushConnectionStatusChange updates the status of a service for
// human readable connection status tracking.
PushConnectionStatusChange(service string, newStatus error)
}
KBFSOps handles all file system operations. Expands all indirect pointers. Operations that modify the server data change all the block IDs along the path, and so must return a path with the new BlockIds so the caller can update their references.
KBFSOps implementations must guarantee goroutine-safety of calls on a per-top-level-folder basis.
There are two types of operations that could block:
- remote-sync operations, that need to synchronously update the MD for the corresponding top-level folder. When these operations return successfully, they will have guaranteed to have successfully written the modification to the KBFS servers.
- remote-access operations, that don't sync any modifications to KBFS servers, but may block on reading data from the servers.
KBFSOps implementations are supposed to give git-like consistency semantics for modification operations; they will be visible to other clients immediately after the remote-sync operations succeed, if and only if there was no other intervening modification to the same folder. If not, the change will be sync'd to the server in a special per-device "unmerged" area before the operation succeeds. In this case, the modification will not be visible to other clients until the KBFS code on this device performs automatic conflict resolution in the background.
All methods take a Context (see https://blog.golang.org/context), and if that context is cancelled during the operation, KBFSOps will abort any blocking calls and return ctx.Err(). Any notifications resulting from an operation will also include this ctx (or a Context derived from it), allowing the caller to determine whether the notification is a result of their own action or an external action.
type KBFSOpsStandard ¶
type KBFSOpsStandard struct {
// contains filtered or unexported fields
}
KBFSOpsStandard implements the KBFSOps interface, and is go-routine safe by forwarding requests to individual per-folder-branch handlers that are go-routine-safe.
func NewKBFSOpsStandard ¶
func NewKBFSOpsStandard(config Config) *KBFSOpsStandard
NewKBFSOpsStandard constructs a new KBFSOpsStandard object.
func (*KBFSOpsStandard) AddFavorite ¶
func (fs *KBFSOpsStandard) AddFavorite(ctx context.Context, fav Favorite) error
AddFavorite implements the KBFSOps interface for KBFSOpsStandard.
func (*KBFSOpsStandard) CreateDir ¶
func (fs *KBFSOpsStandard) CreateDir( ctx context.Context, dir Node, name string) (Node, EntryInfo, error)
CreateDir implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) CreateFile ¶
func (fs *KBFSOpsStandard) CreateFile( ctx context.Context, dir Node, name string, isExec bool, excl Excl) ( Node, EntryInfo, error)
CreateFile implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) CreateLink ¶
func (fs *KBFSOpsStandard) CreateLink( ctx context.Context, dir Node, fromName string, toPath string) ( EntryInfo, error)
CreateLink implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) DeleteFavorite ¶
func (fs *KBFSOpsStandard) DeleteFavorite(ctx context.Context, fav Favorite) error
DeleteFavorite implements the KBFSOps interface for KBFSOpsStandard.
func (*KBFSOpsStandard) FolderStatus ¶
func (fs *KBFSOpsStandard) FolderStatus( ctx context.Context, folderBranch FolderBranch) ( FolderBranchStatus, <-chan StatusUpdate, error)
FolderStatus implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) GetDirChildren ¶
func (fs *KBFSOpsStandard) GetDirChildren(ctx context.Context, dir Node) ( map[string]EntryInfo, error)
GetDirChildren implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) GetEditHistory ¶
func (fs *KBFSOpsStandard) GetEditHistory(ctx context.Context, folderBranch FolderBranch) (edits TlfWriterEdits, err error)
GetEditHistory implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) GetFavorites ¶
func (fs *KBFSOpsStandard) GetFavorites(ctx context.Context) ( []Favorite, error)
GetFavorites implements the KBFSOps interface for KBFSOpsStandard.
func (*KBFSOpsStandard) GetOrCreateRootNode ¶
func (fs *KBFSOpsStandard) GetOrCreateRootNode( ctx context.Context, h *TlfHandle, branch BranchName) ( node Node, ei EntryInfo, err error)
GetOrCreateRootNode implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) GetRootNode ¶
func (fs *KBFSOpsStandard) GetRootNode( ctx context.Context, h *TlfHandle, branch BranchName) ( node Node, ei EntryInfo, err error)
GetRootNode implements the KBFSOps interface for KBFSOpsStandard. Returns a nil Node and nil error if the tlf does not exist but there is no error present.
func (*KBFSOpsStandard) GetTLFCryptKeys ¶
func (fs *KBFSOpsStandard) GetTLFCryptKeys(ctx context.Context, tlfHandle *TlfHandle) (keys []TLFCryptKey, id TlfID, err error)
GetTLFCryptKeys implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) GetUpdateHistory ¶
func (fs *KBFSOpsStandard) GetUpdateHistory(ctx context.Context, folderBranch FolderBranch) (history TLFUpdateHistory, err error)
GetUpdateHistory implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) Lookup ¶
func (fs *KBFSOpsStandard) Lookup(ctx context.Context, dir Node, name string) ( Node, EntryInfo, error)
Lookup implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) PushConnectionStatusChange ¶
func (fs *KBFSOpsStandard) PushConnectionStatusChange(service string, newStatus error)
PushConnectionStatusChange pushes human readable connection status changes.
func (*KBFSOpsStandard) Read ¶
func (fs *KBFSOpsStandard) Read( ctx context.Context, file Node, dest []byte, off int64) ( numRead int64, err error)
Read implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) RefreshCachedFavorites ¶
func (fs *KBFSOpsStandard) RefreshCachedFavorites(ctx context.Context)
RefreshCachedFavorites implements the KBFSOps interface for KBFSOpsStandard.
func (*KBFSOpsStandard) RegisterForChanges ¶
func (fs *KBFSOpsStandard) RegisterForChanges( folderBranches []FolderBranch, obs Observer) error
RegisterForChanges implements the Notifer interface for KBFSOpsStandard
func (*KBFSOpsStandard) Rekey ¶
func (fs *KBFSOpsStandard) Rekey(ctx context.Context, id TlfID) error
Rekey implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) RemoveEntry ¶
RemoveEntry implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) Rename ¶
func (fs *KBFSOpsStandard) Rename( ctx context.Context, oldParent Node, oldName string, newParent Node, newName string) error
Rename implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) Shutdown ¶
func (fs *KBFSOpsStandard) Shutdown() error
Shutdown safely shuts down any background goroutines that may have been launched by KBFSOpsStandard.
func (*KBFSOpsStandard) Status ¶
func (fs *KBFSOpsStandard) Status(ctx context.Context) ( KBFSStatus, <-chan StatusUpdate, error)
Status implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) Sync ¶
func (fs *KBFSOpsStandard) Sync(ctx context.Context, file Node) error
Sync implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) SyncFromServerForTesting ¶
func (fs *KBFSOpsStandard) SyncFromServerForTesting( ctx context.Context, folderBranch FolderBranch) error
SyncFromServerForTesting implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) UnregisterFromChanges ¶
func (fs *KBFSOpsStandard) UnregisterFromChanges( folderBranches []FolderBranch, obs Observer) error
UnregisterFromChanges implements the Notifer interface for KBFSOpsStandard
func (*KBFSOpsStandard) UnstageForTesting ¶
func (fs *KBFSOpsStandard) UnstageForTesting( ctx context.Context, folderBranch FolderBranch) error
UnstageForTesting implements the KBFSOps interface for KBFSOpsStandard TODO: remove once we have automatic conflict resolution
type KBFSStatus ¶
type KBFSStatus struct {
CurrentUser string
IsConnected bool
UsageBytes int64
LimitBytes int64
FailingServices map[string]error
JournalServer *JournalServerStatus `json:",omitempty"`
}
KBFSStatus represents the content of the top-level status file. It is suitable for encoding directly as JSON. TODO: implement magical status update like FolderBranchStatus
type KBPKI ¶
type KBPKI interface {
// GetCurrentToken gets the current keybase session token.
GetCurrentToken(ctx context.Context) (string, error)
// GetCurrentUserInfo gets the name and UID of the current
// logged-in user.
GetCurrentUserInfo(ctx context.Context) (
libkb.NormalizedUsername, keybase1.UID, error)
// GetCurrentCryptPublicKey gets the crypt public key for the
// currently-active device.
GetCurrentCryptPublicKey(ctx context.Context) (CryptPublicKey, error)
// GetCurrentVerifyingKey gets the public key used for signing for the
// currently-active device.
GetCurrentVerifyingKey(ctx context.Context) (VerifyingKey, error)
// HasVerifyingKey returns nil if the given user has the given
// VerifyingKey, and an error otherwise.
HasVerifyingKey(ctx context.Context, uid keybase1.UID,
verifyingKey VerifyingKey, atServerTime time.Time) error
// HasUnverifiedVerifyingKey returns nil if the given user has the given
// unverified VerifyingKey, and an error otherwise. Note that any match
// is with a key not verified to be currently connected to the user via
// their sigchain. This is currently only used to verify finalized or
// reset TLFs. Further note that unverified keys is a super set of
// verified keys.
HasUnverifiedVerifyingKey(ctx context.Context, uid keybase1.UID,
verifyingKey VerifyingKey) error
// GetCryptPublicKeys gets all of a user's crypt public keys (including
// paper keys).
GetCryptPublicKeys(ctx context.Context, uid keybase1.UID) (
[]CryptPublicKey, error)
// FavoriteAdd adds folder to the list of the logged in user's
// favorite folders. It is idempotent.
FavoriteAdd(ctx context.Context, folder keybase1.Folder) error
// FavoriteDelete deletes folder from the list of the logged in user's
// favorite folders. It is idempotent.
FavoriteDelete(ctx context.Context, folder keybase1.Folder) error
// FavoriteList returns the list of all favorite folders for
// the logged in user.
FavoriteList(ctx context.Context) ([]keybase1.Folder, error)
// Notify sends a filesystem notification.
Notify(ctx context.Context, notification *keybase1.FSNotification) error
// contains filtered or unexported methods
}
KBPKI interacts with the Keybase daemon to fetch user info.
type KBPKIClient ¶
type KBPKIClient struct {
// contains filtered or unexported fields
}
KBPKIClient uses a config's KeybaseService.
func NewKBPKIClient ¶
func NewKBPKIClient(config Config) *KBPKIClient
NewKBPKIClient returns a new KBPKIClient with the given Config.
func (*KBPKIClient) FavoriteAdd ¶
FavoriteAdd implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) FavoriteDelete ¶
FavoriteDelete implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) FavoriteList ¶
FavoriteList implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) GetCryptPublicKeys ¶
func (k *KBPKIClient) GetCryptPublicKeys(ctx context.Context, uid keybase1.UID) (keys []CryptPublicKey, err error)
GetCryptPublicKeys implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) GetCurrentCryptPublicKey ¶
func (k *KBPKIClient) GetCurrentCryptPublicKey(ctx context.Context) ( CryptPublicKey, error)
GetCurrentCryptPublicKey implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) GetCurrentToken ¶
func (k *KBPKIClient) GetCurrentToken(ctx context.Context) (string, error)
GetCurrentToken implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) GetCurrentUserInfo ¶
func (k *KBPKIClient) GetCurrentUserInfo(ctx context.Context) ( libkb.NormalizedUsername, keybase1.UID, error)
GetCurrentUserInfo implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) GetCurrentVerifyingKey ¶
func (k *KBPKIClient) GetCurrentVerifyingKey(ctx context.Context) ( VerifyingKey, error)
GetCurrentVerifyingKey implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) GetNormalizedUsername ¶
func (k *KBPKIClient) GetNormalizedUsername(ctx context.Context, uid keybase1.UID) ( libkb.NormalizedUsername, error)
GetNormalizedUsername implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) HasUnverifiedVerifyingKey ¶
func (k *KBPKIClient) HasUnverifiedVerifyingKey(ctx context.Context, uid keybase1.UID, verifyingKey VerifyingKey) error
HasUnverifiedVerifyingKey implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) HasVerifyingKey ¶
func (k *KBPKIClient) HasVerifyingKey(ctx context.Context, uid keybase1.UID, verifyingKey VerifyingKey, atServerTime time.Time) error
HasVerifyingKey implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) Notify ¶
func (k *KBPKIClient) Notify(ctx context.Context, notification *keybase1.FSNotification) error
Notify implements the KBPKI interface for KBPKIClient.
type KeyCache ¶
type KeyCache interface {
// GetTLFCryptKey gets the crypt key for the given TLF.
GetTLFCryptKey(TlfID, KeyGen) (TLFCryptKey, error)
// PutTLFCryptKey stores the crypt key for the given TLF.
PutTLFCryptKey(TlfID, KeyGen, TLFCryptKey) error
}
KeyCache handles caching for both TLFCryptKeys and BlockCryptKeys.
type KeyCacheHitError ¶
type KeyCacheHitError struct {
// contains filtered or unexported fields
}
KeyCacheHitError indicates that a key matching the given TlfID and key generation was found in cache but the object type was unknown.
func (KeyCacheHitError) Error ¶
func (e KeyCacheHitError) Error() string
Error implements the error interface for KeyCacheHitError.
type KeyCacheMeasured ¶
type KeyCacheMeasured struct {
// contains filtered or unexported fields
}
KeyCacheMeasured delegates to another KeyCache instance but also keeps track of stats.
func NewKeyCacheMeasured ¶
func NewKeyCacheMeasured(delegate KeyCache, r metrics.Registry) KeyCacheMeasured
NewKeyCacheMeasured creates and returns a new KeyCacheMeasured instance with the given delegate and registry.
func (KeyCacheMeasured) GetTLFCryptKey ¶
func (b KeyCacheMeasured) GetTLFCryptKey(tlfID TlfID, keyGen KeyGen) (key TLFCryptKey, err error)
GetTLFCryptKey implements the KeyCache interface for KeyCacheMeasured.
func (KeyCacheMeasured) PutTLFCryptKey ¶
func (b KeyCacheMeasured) PutTLFCryptKey(tlfID TlfID, keyGen KeyGen, key TLFCryptKey) (err error)
PutTLFCryptKey implements the KeyCache interface for KeyCacheMeasured.
type KeyCacheMissError ¶
type KeyCacheMissError struct {
// contains filtered or unexported fields
}
KeyCacheMissError indicates that a key matching the given TlfID and key generation wasn't found in cache.
func (KeyCacheMissError) Error ¶
func (e KeyCacheMissError) Error() string
Error implements the error interface for KeyCacheMissError.
type KeyCacheNull ¶
type KeyCacheNull struct{}
KeyCacheNull is a placeholder, noop implementation of the KeyCache interface.
func (*KeyCacheNull) GetTLFCryptKey ¶
func (k *KeyCacheNull) GetTLFCryptKey(TlfID, KeyGen) (TLFCryptKey, error)
GetTLFCryptKey implements the KeyCache interface for KeyCacheNull.
func (*KeyCacheNull) PutTLFCryptKey ¶
func (k *KeyCacheNull) PutTLFCryptKey(TlfID, KeyGen, TLFCryptKey) error
PutTLFCryptKey implements the KeyCache interface for KeyCacheNull.
type KeyCacheStandard ¶
type KeyCacheStandard struct {
// contains filtered or unexported fields
}
KeyCacheStandard is an LRU-based implementation of the KeyCache interface.
func NewKeyCacheStandard ¶
func NewKeyCacheStandard(capacity int) *KeyCacheStandard
NewKeyCacheStandard constructs a new KeyCacheStandard with the given cache capacity.
func (*KeyCacheStandard) GetTLFCryptKey ¶
func (k *KeyCacheStandard) GetTLFCryptKey(tlf TlfID, keyGen KeyGen) ( TLFCryptKey, error)
GetTLFCryptKey implements the KeyCache interface for KeyCacheStandard.
func (*KeyCacheStandard) PutTLFCryptKey ¶
func (k *KeyCacheStandard) PutTLFCryptKey(tlf TlfID, keyGen KeyGen, key TLFCryptKey) error
PutTLFCryptKey implements the KeyCache interface for KeyCacheStandard.
type KeyGen ¶
type KeyGen int
KeyGen is the type of a key generation for a top-level folder.
const ( // PublicKeyGen is the value used for public TLFs. Note that // it is not considered a valid key generation. PublicKeyGen KeyGen = -1 // FirstValidKeyGen is the first value that is considered a // valid key generation. Note that the nil value is not // considered valid. FirstValidKeyGen = 1 )
type KeyHalfMismatchError ¶
type KeyHalfMismatchError struct {
Expected TLFCryptKeyServerHalfID
Actual TLFCryptKeyServerHalfID
}
KeyHalfMismatchError is returned when the key server doesn't return the expected key half.
func (KeyHalfMismatchError) Error ¶
func (e KeyHalfMismatchError) Error() string
Error implements the error interface for KeyHalfMismatchError.
type KeyManager ¶
type KeyManager interface {
// GetTLFCryptKeyForMDDecryption gets the crypt key to use for the
// TLF with the given metadata to decrypt the private portion of
// the metadata. It finds the appropriate key from mdWithKeys
// (which in most cases is the same as mdToDecrypt) if it's not
// already cached.
GetTLFCryptKeyForMDDecryption(ctx context.Context,
kmdToDecrypt, kmdWithKeys KeyMetadata) (TLFCryptKey, error)
// GetTLFCryptKeyForBlockDecryption gets the crypt key to use
// for the TLF with the given metadata to decrypt the block
// pointed to by the given pointer.
GetTLFCryptKeyForBlockDecryption(ctx context.Context, kmd KeyMetadata,
blockPtr BlockPointer) (TLFCryptKey, error)
// GetTLFCryptKeyOfAllGenerations gets the crypt keys of all generations
// for current devices. keys contains crypt keys from all generations, in
// order, starting from FirstValidKeyGen.
GetTLFCryptKeyOfAllGenerations(ctx context.Context, kmd KeyMetadata) (
keys []TLFCryptKey, err error)
// Rekey checks the given MD object, if it is a private TLF,
// against the current set of device keys for all valid
// readers and writers. If there are any new devices, it
// updates all existing key generations to include the new
// devices. If there are devices that have been removed, it
// creates a new epoch of keys for the TLF. If no devices
// have changed, or if there was an error, it returns false.
// Otherwise, it returns true. If a new key generation is
// added the second return value points to this new key. This
// is to allow for caching of the TLF crypt key only after a
// successful merged write of the metadata. Otherwise we could
// prematurely pollute the key cache.
//
// If the given MD object is a public TLF, it simply updates
// the TLF's handle with any newly-resolved writers.
//
// If promptPaper is set, prompts for any unlocked paper keys.
// promptPaper shouldn't be set if md is for a public TLF.
Rekey(ctx context.Context, md *RootMetadata, promptPaper bool) (bool, *TLFCryptKey, error)
// contains filtered or unexported methods
}
KeyManager fetches and constructs the keys needed for KBFS file operations.
type KeyManagerStandard ¶
type KeyManagerStandard struct {
// contains filtered or unexported fields
}
KeyManagerStandard implements the KeyManager interface by fetching keys from KeyOps and KBPKI, and computing the complete keys necessary to run KBFS.
func NewKeyManagerStandard ¶
func NewKeyManagerStandard(config Config) *KeyManagerStandard
NewKeyManagerStandard returns a new KeyManagerStandard
func (*KeyManagerStandard) GetTLFCryptKeyForBlockDecryption ¶
func (km *KeyManagerStandard) GetTLFCryptKeyForBlockDecryption( ctx context.Context, kmd KeyMetadata, blockPtr BlockPointer) ( tlfCryptKey TLFCryptKey, err error)
GetTLFCryptKeyForBlockDecryption implements the KeyManager interface for KeyManagerStandard.
func (*KeyManagerStandard) GetTLFCryptKeyForEncryption ¶
func (km *KeyManagerStandard) GetTLFCryptKeyForEncryption(ctx context.Context, kmd KeyMetadata) (tlfCryptKey TLFCryptKey, err error)
GetTLFCryptKeyForEncryption implements the KeyManager interface for KeyManagerStandard.
func (*KeyManagerStandard) GetTLFCryptKeyForMDDecryption ¶
func (km *KeyManagerStandard) GetTLFCryptKeyForMDDecryption( ctx context.Context, kmdToDecrypt, kmdWithKeys KeyMetadata) ( tlfCryptKey TLFCryptKey, err error)
GetTLFCryptKeyForMDDecryption implements the KeyManager interface for KeyManagerStandard.
func (*KeyManagerStandard) GetTLFCryptKeyOfAllGenerations ¶
func (km *KeyManagerStandard) GetTLFCryptKeyOfAllGenerations( ctx context.Context, kmd KeyMetadata) (keys []TLFCryptKey, err error)
GetTLFCryptKeyOfAllGenerations implements the KeyManager interface for KeyManagerStandard.
func (*KeyManagerStandard) Rekey ¶
func (km *KeyManagerStandard) Rekey(ctx context.Context, md *RootMetadata, promptPaper bool) ( rekeyDone bool, cryptKey *TLFCryptKey, err error)
Rekey implements the KeyManager interface for KeyManagerStandard. TODO make this less terrible.
type KeyMetadata ¶
type KeyMetadata interface {
// TlfID returns the ID of the TLF for which this object holds
// key info.
TlfID() TlfID
// LatestKeyGeneration returns the most recent key generation
// with key data in this object, or PublicKeyGen if this TLF
// is public.
LatestKeyGeneration() KeyGen
// GetTlfHandle returns the handle for the TLF. It must not
// return nil.
//
// TODO: Remove the need for this function in this interface,
// so that BareRootMetadata can implement this interface
// fully.
GetTlfHandle() *TlfHandle
// HasKeyForUser returns whether or not the given user has
// keys for at least one device at the given key
// generation. Returns false if the TLF is public, or if the
// given key generation is invalid.
HasKeyForUser(keyGen KeyGen, user keybase1.UID) bool
// GetTLFCryptKeyParams returns all the necessary info to
// construct the TLF crypt key for the given key generation,
// user, and device (identified by its crypt public key), or
// false if not found. This returns an error if the TLF is
// public.
GetTLFCryptKeyParams(
keyGen KeyGen, user keybase1.UID, key CryptPublicKey) (
TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf,
TLFCryptKeyServerHalfID, bool, error)
}
KeyMetadata is an interface for something that holds key information. This is usually implemented by RootMetadata.
type KeyNotFoundError ¶
type KeyNotFoundError struct {
// contains filtered or unexported fields
}
KeyNotFoundError indicates that a key matching the given KID couldn't be found.
func (KeyNotFoundError) Error ¶
func (e KeyNotFoundError) Error() string
Error implements the error interface for KeyNotFoundError.
type KeyOps ¶
type KeyOps interface {
// GetTLFCryptKeyServerHalf gets a server-side key half for a
// device given the key half ID.
GetTLFCryptKeyServerHalf(ctx context.Context,
serverHalfID TLFCryptKeyServerHalfID,
cryptPublicKey CryptPublicKey) (TLFCryptKeyServerHalf, error)
// PutTLFCryptKeyServerHalves stores a server-side key halves for a
// set of users and devices.
PutTLFCryptKeyServerHalves(ctx context.Context,
serverKeyHalves map[keybase1.UID]map[keybase1.KID]TLFCryptKeyServerHalf) error
// DeleteTLFCryptKeyServerHalf deletes a server-side key half for a
// device given the key half ID.
DeleteTLFCryptKeyServerHalf(ctx context.Context,
uid keybase1.UID, kid keybase1.KID,
serverHalfID TLFCryptKeyServerHalfID) error
}
KeyOps fetches server-side key halves from the key server.
type KeyOpsStandard ¶
type KeyOpsStandard struct {
// contains filtered or unexported fields
}
KeyOpsStandard implements the KeyOps interface and relays get/put requests for server-side key halves from/to the key server.
func (*KeyOpsStandard) DeleteTLFCryptKeyServerHalf ¶
func (k *KeyOpsStandard) DeleteTLFCryptKeyServerHalf(ctx context.Context, uid keybase1.UID, kid keybase1.KID, serverHalfID TLFCryptKeyServerHalfID) error
DeleteTLFCryptKeyServerHalf is an implementation of the KeyOps interface.
func (*KeyOpsStandard) GetTLFCryptKeyServerHalf ¶
func (k *KeyOpsStandard) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, key CryptPublicKey) ( TLFCryptKeyServerHalf, error)
GetTLFCryptKeyServerHalf is an implementation of the KeyOps interface.
func (*KeyOpsStandard) PutTLFCryptKeyServerHalves ¶
func (k *KeyOpsStandard) PutTLFCryptKeyServerHalves(ctx context.Context, serverKeyHalves map[keybase1.UID]map[keybase1.KID]TLFCryptKeyServerHalf) error
PutTLFCryptKeyServerHalves is an implementation of the KeyOps interface.
type KeyServer ¶
type KeyServer interface {
// GetTLFCryptKeyServerHalf gets a server-side key half for a
// device given the key half ID.
GetTLFCryptKeyServerHalf(ctx context.Context,
serverHalfID TLFCryptKeyServerHalfID,
cryptPublicKey CryptPublicKey) (TLFCryptKeyServerHalf, error)
// PutTLFCryptKeyServerHalves stores a server-side key halves for a
// set of users and devices.
PutTLFCryptKeyServerHalves(ctx context.Context,
serverKeyHalves map[keybase1.UID]map[keybase1.KID]TLFCryptKeyServerHalf) error
// DeleteTLFCryptKeyServerHalf deletes a server-side key half for a
// device given the key half ID.
DeleteTLFCryptKeyServerHalf(ctx context.Context,
uid keybase1.UID, kid keybase1.KID,
serverHalfID TLFCryptKeyServerHalfID) error
// Shutdown is called to free any KeyServer resources.
Shutdown()
}
KeyServer fetches/writes server-side key halves from/to the key server.
type KeyServerLocal ¶
type KeyServerLocal struct {
// contains filtered or unexported fields
}
KeyServerLocal puts/gets key server halves in/from a local leveldb instance.
func NewKeyServerDir ¶
func NewKeyServerDir(config Config, dirPath string) (*KeyServerLocal, error)
NewKeyServerDir constructs a new KeyServerLocal that stores its data in the given directory.
func NewKeyServerMemory ¶
func NewKeyServerMemory(config Config) (*KeyServerLocal, error)
NewKeyServerMemory returns a KeyServerLocal with an in-memory leveldb instance.
func NewKeyServerTempDir ¶
func NewKeyServerTempDir(config Config) (*KeyServerLocal, error)
NewKeyServerTempDir constructs a new KeyServerLocal that stores its data in a temp directory which is cleaned up on shutdown.
func (*KeyServerLocal) DeleteTLFCryptKeyServerHalf ¶
func (ks *KeyServerLocal) DeleteTLFCryptKeyServerHalf(ctx context.Context, _ keybase1.UID, _ keybase1.KID, serverHalfID TLFCryptKeyServerHalfID) error
DeleteTLFCryptKeyServerHalf implements the KeyOps interface for KeyServerLocal.
func (*KeyServerLocal) GetTLFCryptKeyServerHalf ¶
func (ks *KeyServerLocal) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, key CryptPublicKey) (serverHalf TLFCryptKeyServerHalf, err error)
GetTLFCryptKeyServerHalf implements the KeyServer interface for KeyServerLocal.
func (*KeyServerLocal) PutTLFCryptKeyServerHalves ¶
func (ks *KeyServerLocal) PutTLFCryptKeyServerHalves(ctx context.Context, serverKeyHalves map[keybase1.UID]map[keybase1.KID]TLFCryptKeyServerHalf) error
PutTLFCryptKeyServerHalves implements the KeyOps interface for KeyServerLocal.
func (*KeyServerLocal) Shutdown ¶
func (ks *KeyServerLocal) Shutdown()
Shutdown implements the KeyServer interface for KeyServerLocal.
type KeyServerMeasured ¶
type KeyServerMeasured struct {
// contains filtered or unexported fields
}
KeyServerMeasured delegates to another KeyServer instance but also keeps track of stats.
func NewKeyServerMeasured ¶
func NewKeyServerMeasured(delegate KeyServer, r metrics.Registry) KeyServerMeasured
NewKeyServerMeasured creates and returns a new KeyServerMeasured instance with the given delegate and registry.
func (KeyServerMeasured) DeleteTLFCryptKeyServerHalf ¶
func (b KeyServerMeasured) DeleteTLFCryptKeyServerHalf(ctx context.Context, uid keybase1.UID, kid keybase1.KID, serverHalfID TLFCryptKeyServerHalfID) (err error)
DeleteTLFCryptKeyServerHalf implements the KeyServer interface for KeyServerMeasured.
func (KeyServerMeasured) GetTLFCryptKeyServerHalf ¶
func (b KeyServerMeasured) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, key CryptPublicKey) ( serverHalf TLFCryptKeyServerHalf, err error)
GetTLFCryptKeyServerHalf implements the KeyServer interface for KeyServerMeasured.
func (KeyServerMeasured) PutTLFCryptKeyServerHalves ¶
func (b KeyServerMeasured) PutTLFCryptKeyServerHalves(ctx context.Context, serverKeyHalves map[keybase1.UID]map[keybase1.KID]TLFCryptKeyServerHalf) (err error)
PutTLFCryptKeyServerHalves implements the KeyServer interface for KeyServerMeasured.
func (KeyServerMeasured) Shutdown ¶
func (b KeyServerMeasured) Shutdown()
Shutdown implements the KeyServer interface for KeyServerMeasured.
type KeybaseDaemonLocal ¶
type KeybaseDaemonLocal struct {
// contains filtered or unexported fields
}
KeybaseDaemonLocal implements KeybaseDaemon using an in-memory user and session store, and a given favorite store.
func NewKeybaseDaemonDisk ¶
func NewKeybaseDaemonDisk(currentUID keybase1.UID, users []LocalUser, favDBFile string, codec Codec) (*KeybaseDaemonLocal, error)
NewKeybaseDaemonDisk constructs a KeybaseDaemonLocal object given a set of possible users, and one user that should be "logged in". Any storage (e.g. the favorites) persists to disk.
func NewKeybaseDaemonMemory ¶
func NewKeybaseDaemonMemory(currentUID keybase1.UID, users []LocalUser, codec Codec) *KeybaseDaemonLocal
NewKeybaseDaemonMemory constructs a KeybaseDaemonLocal object given a set of possible users, and one user that should be "logged in". Any storage (e.g. the favorites) is kept in memory only.
func (*KeybaseDaemonLocal) CurrentSession ¶
func (k *KeybaseDaemonLocal) CurrentSession(ctx context.Context, sessionID int) ( SessionInfo, error)
CurrentSession implements KeybaseDaemon for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) FavoriteAdd ¶
FavoriteAdd implements KeybaseDaemon for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) FavoriteDelete ¶
FavoriteDelete implements KeybaseDaemon for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) FavoriteList ¶
func (k *KeybaseDaemonLocal) FavoriteList( ctx context.Context, sessionID int) ([]keybase1.Folder, error)
FavoriteList implements KeybaseDaemon for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) FlushUserFromLocalCache ¶
func (k *KeybaseDaemonLocal) FlushUserFromLocalCache(ctx context.Context, uid keybase1.UID)
FlushUserFromLocalCache implements the KeybaseDaemon interface for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) FlushUserUnverifiedKeysFromLocalCache ¶
func (k *KeybaseDaemonLocal) FlushUserUnverifiedKeysFromLocalCache(ctx context.Context, uid keybase1.UID)
FlushUserUnverifiedKeysFromLocalCache implements the KeybaseDaemon interface for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) Identify ¶
func (k *KeybaseDaemonLocal) Identify(ctx context.Context, assertion, reason string) ( UserInfo, error)
Identify implements KeybaseDaemon for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) LoadUnverifiedKeys ¶
func (k *KeybaseDaemonLocal) LoadUnverifiedKeys(ctx context.Context, uid keybase1.UID) ( []keybase1.PublicKey, error)
LoadUnverifiedKeys implements KeybaseDaemon for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) LoadUserPlusKeys ¶
func (k *KeybaseDaemonLocal) LoadUserPlusKeys(ctx context.Context, uid keybase1.UID) (UserInfo, error)
LoadUserPlusKeys implements KeybaseDaemon for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) Notify ¶
func (k *KeybaseDaemonLocal) Notify(ctx context.Context, notification *keybase1.FSNotification) error
Notify implements KeybaseDaemon for KeybaseDeamonLocal.
func (*KeybaseDaemonLocal) Resolve ¶
func (k *KeybaseDaemonLocal) Resolve(ctx context.Context, assertion string) ( libkb.NormalizedUsername, keybase1.UID, error)
Resolve implements KeybaseDaemon for KeybaseDaemonLocal.
func (*KeybaseDaemonLocal) Shutdown ¶
func (k *KeybaseDaemonLocal) Shutdown()
Shutdown implements KeybaseDaemon for KeybaseDaemonLocal.
type KeybaseDaemonRPC ¶
type KeybaseDaemonRPC struct {
*KeybaseServiceBase
// contains filtered or unexported fields
}
KeybaseDaemonRPC implements the KeybaseService interface using RPC calls.
func NewKeybaseDaemonRPC ¶
func NewKeybaseDaemonRPC(config Config, kbCtx Context, log logger.Logger, debug bool) *KeybaseDaemonRPC
NewKeybaseDaemonRPC makes a new KeybaseDaemonRPC that makes RPC calls using the socket of the given Keybase context.
func (*KeybaseDaemonRPC) AddProtocols ¶
func (k *KeybaseDaemonRPC) AddProtocols(protocols []rpc.Protocol)
AddProtocols adds protocols that are registered on server connect
func (*KeybaseDaemonRPC) HandlerName ¶
func (*KeybaseDaemonRPC) HandlerName() string
HandlerName implements the ConnectionHandler interface.
func (*KeybaseDaemonRPC) OnConnect ¶
func (k *KeybaseDaemonRPC) OnConnect(ctx context.Context, conn *rpc.Connection, rawClient rpc.GenericClient, server *rpc.Server) error
OnConnect implements the ConnectionHandler interface.
func (*KeybaseDaemonRPC) OnConnectError ¶
func (k *KeybaseDaemonRPC) OnConnectError(err error, wait time.Duration)
OnConnectError implements the ConnectionHandler interface.
func (*KeybaseDaemonRPC) OnDisconnected ¶
func (k *KeybaseDaemonRPC) OnDisconnected(_ context.Context, status rpc.DisconnectStatus)
OnDisconnected implements the ConnectionHandler interface.
func (*KeybaseDaemonRPC) OnDoCommandError ¶
func (k *KeybaseDaemonRPC) OnDoCommandError(err error, wait time.Duration)
OnDoCommandError implements the ConnectionHandler interface.
func (*KeybaseDaemonRPC) ShouldRetry ¶
func (k *KeybaseDaemonRPC) ShouldRetry(rpcName string, err error) bool
ShouldRetry implements the ConnectionHandler interface.
func (*KeybaseDaemonRPC) ShouldRetryOnConnect ¶
func (k *KeybaseDaemonRPC) ShouldRetryOnConnect(err error) bool
ShouldRetryOnConnect implements the ConnectionHandler interface.
func (*KeybaseDaemonRPC) Shutdown ¶
func (k *KeybaseDaemonRPC) Shutdown()
Shutdown implements the KeybaseService interface for KeybaseDaemonRPC.
type KeybaseService ¶
type KeybaseService interface {
// Resolve, given an assertion, resolves it to a username/UID
// pair. The username <-> UID mapping is trusted and
// immutable, so it can be cached. If the assertion is just
// the username or a UID assertion, then the resolution can
// also be trusted. If the returned pair is equal to that of
// the current session, then it can also be
// trusted. Otherwise, Identify() needs to be called on the
// assertion before the assertion -> (username, UID) mapping
// can be trusted.
Resolve(ctx context.Context, assertion string) (
libkb.NormalizedUsername, keybase1.UID, error)
// Identify, given an assertion, returns a UserInfo struct
// with the user that matches that assertion, or an error
// otherwise. The reason string is displayed on any tracker
// popups spawned.
Identify(ctx context.Context, assertion, reason string) (UserInfo, error)
// LoadUserPlusKeys returns a UserInfo struct for a
// user with the specified UID.
// If you have the UID for a user and don't require Identify to
// validate an assertion or the identity of a user, use this to
// get UserInfo structs as it is much cheaper than Identify.
LoadUserPlusKeys(ctx context.Context, uid keybase1.UID) (UserInfo, error)
// LoadUnverifiedKeys returns a list of unverified public keys. They are the union
// of all known public keys associated with the account and the currently verified
// keys currently part of the user's sigchain.
LoadUnverifiedKeys(ctx context.Context, uid keybase1.UID) (
[]keybase1.PublicKey, error)
// CurrentSession returns a SessionInfo struct with all the
// information for the current session, or an error otherwise.
CurrentSession(ctx context.Context, sessionID int) (SessionInfo, error)
// FavoriteAdd adds the given folder to the list of favorites.
FavoriteAdd(ctx context.Context, folder keybase1.Folder) error
// FavoriteAdd removes the given folder from the list of
// favorites.
FavoriteDelete(ctx context.Context, folder keybase1.Folder) error
// FavoriteList returns the current list of favorites.
FavoriteList(ctx context.Context, sessionID int) ([]keybase1.Folder, error)
// Notify sends a filesystem notification.
Notify(ctx context.Context, notification *keybase1.FSNotification) error
// FlushUserFromLocalCache instructs this layer to clear any
// KBFS-side, locally-cached information about the given user.
// This does NOT involve communication with the daemon, this is
// just to force future calls loading this user to fall through to
// the daemon itself, rather than being served from the cache.
FlushUserFromLocalCache(ctx context.Context, uid keybase1.UID)
// FlushUserUnverifiedKeysFromLocalCache instructs this layer to clear any
// KBFS-side, locally-cached unverified keys for the given user.
FlushUserUnverifiedKeysFromLocalCache(ctx context.Context, uid keybase1.UID)
// Shutdown frees any resources associated with this
// instance. No other methods may be called after this is
// called.
Shutdown()
}
KeybaseService is an interface for communicating with the keybase service.
type KeybaseServiceBase ¶
type KeybaseServiceBase struct {
// contains filtered or unexported fields
}
KeybaseServiceBase implements most of KeybaseService from protocol defined clients.
func NewKeybaseServiceBase ¶
func NewKeybaseServiceBase(config Config, kbCtx Context, log logger.Logger) *KeybaseServiceBase
NewKeybaseServiceBase makes a new KeybaseService.
func (*KeybaseServiceBase) ClientOutOfDate ¶
func (k *KeybaseServiceBase) ClientOutOfDate(ctx context.Context, arg keybase1.ClientOutOfDateArg) error
ClientOutOfDate implements keybase1.NotifySessionInterface.
func (*KeybaseServiceBase) CurrentSession ¶
func (k *KeybaseServiceBase) CurrentSession(ctx context.Context, sessionID int) ( SessionInfo, error)
CurrentSession implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) FSEditListRequest ¶
func (k *KeybaseServiceBase) FSEditListRequest(ctx context.Context, req keybase1.FSEditListRequest) (err error)
FSEditListRequest implements keybase1.NotifyFSRequestInterface for KeybaseServiceBase.
func (*KeybaseServiceBase) FavoriteAdd ¶
FavoriteAdd implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) FavoriteDelete ¶
FavoriteDelete implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) FavoriteList ¶
func (k *KeybaseServiceBase) FavoriteList(ctx context.Context, sessionID int) ([]keybase1.Folder, error)
FavoriteList implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) FillClients ¶
func (k *KeybaseServiceBase) FillClients(identifyClient keybase1.IdentifyInterface, userClient keybase1.UserInterface, sessionClient keybase1.SessionInterface, favoriteClient keybase1.FavoriteInterface, kbfsClient keybase1.KbfsInterface)
FillClients sets the client protocol implementations needed for a KeybaseService.
func (*KeybaseServiceBase) FlushUserFromLocalCache ¶
func (k *KeybaseServiceBase) FlushUserFromLocalCache(ctx context.Context, uid keybase1.UID)
FlushUserFromLocalCache implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) FlushUserUnverifiedKeysFromLocalCache ¶
func (k *KeybaseServiceBase) FlushUserUnverifiedKeysFromLocalCache(ctx context.Context, uid keybase1.UID)
FlushUserUnverifiedKeysFromLocalCache implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) GetTLFCryptKeys ¶
func (k *KeybaseServiceBase) GetTLFCryptKeys(ctx context.Context, tlfName string) (res keybase1.TLFCryptKeys, err error)
GetTLFCryptKeys implements the TlfKeysInterface interface for KeybaseServiceBase.
func (*KeybaseServiceBase) Identify ¶
func (k *KeybaseServiceBase) Identify(ctx context.Context, assertion, reason string) ( UserInfo, error)
Identify implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) KeyfamilyChanged ¶
KeyfamilyChanged implements keybase1.NotifyKeyfamilyInterface.
func (*KeybaseServiceBase) LoadUnverifiedKeys ¶
func (k *KeybaseServiceBase) LoadUnverifiedKeys(ctx context.Context, uid keybase1.UID) ( []keybase1.PublicKey, error)
LoadUnverifiedKeys implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) LoadUserPlusKeys ¶
func (k *KeybaseServiceBase) LoadUserPlusKeys(ctx context.Context, uid keybase1.UID) ( UserInfo, error)
LoadUserPlusKeys implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) LoggedIn ¶
func (k *KeybaseServiceBase) LoggedIn(ctx context.Context, name string) error
LoggedIn implements keybase1.NotifySessionInterface.
func (*KeybaseServiceBase) LoggedOut ¶
func (k *KeybaseServiceBase) LoggedOut(ctx context.Context) error
LoggedOut implements keybase1.NotifySessionInterface.
func (*KeybaseServiceBase) Notify ¶
func (k *KeybaseServiceBase) Notify(ctx context.Context, notification *keybase1.FSNotification) error
Notify implements the KeybaseService interface for KeybaseServiceBase.
func (*KeybaseServiceBase) PaperKeyCached ¶
func (k *KeybaseServiceBase) PaperKeyCached(ctx context.Context, arg keybase1.PaperKeyCachedArg) error
PaperKeyCached implements keybase1.NotifyPaperKeyInterface.
type KeybaseServiceCn ¶
type KeybaseServiceCn interface {
NewKeybaseService(config Config, params InitParams, ctx Context, log logger.Logger) (KeybaseService, error)
NewCrypto(config Config, params InitParams, ctx Context, log logger.Logger) (Crypto, error)
}
KeybaseServiceCn defines methods needed to construct KeybaseService and Crypto implementations.
type KeybaseServiceMeasured ¶
type KeybaseServiceMeasured struct {
// contains filtered or unexported fields
}
KeybaseServiceMeasured delegates to another KeybaseService instance but also keeps track of stats.
func NewKeybaseServiceMeasured ¶
func NewKeybaseServiceMeasured(delegate KeybaseService, r metrics.Registry) KeybaseServiceMeasured
NewKeybaseServiceMeasured creates and returns a new KeybaseServiceMeasured instance with the given delegate and registry.
func (KeybaseServiceMeasured) CurrentSession ¶
func (k KeybaseServiceMeasured) CurrentSession(ctx context.Context, sessionID int) ( sessionInfo SessionInfo, err error)
CurrentSession implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) FavoriteAdd ¶
func (k KeybaseServiceMeasured) FavoriteAdd(ctx context.Context, folder keybase1.Folder) (err error)
FavoriteAdd implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) FavoriteDelete ¶
func (k KeybaseServiceMeasured) FavoriteDelete(ctx context.Context, folder keybase1.Folder) (err error)
FavoriteDelete implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) FavoriteList ¶
func (k KeybaseServiceMeasured) FavoriteList(ctx context.Context, sessionID int) ( favorites []keybase1.Folder, err error)
FavoriteList implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) FlushUserFromLocalCache ¶
func (k KeybaseServiceMeasured) FlushUserFromLocalCache( ctx context.Context, uid keybase1.UID)
FlushUserFromLocalCache implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) FlushUserUnverifiedKeysFromLocalCache ¶
func (k KeybaseServiceMeasured) FlushUserUnverifiedKeysFromLocalCache( ctx context.Context, uid keybase1.UID)
FlushUserUnverifiedKeysFromLocalCache implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) Identify ¶
func (k KeybaseServiceMeasured) Identify(ctx context.Context, assertion, reason string) ( userInfo UserInfo, err error)
Identify implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) LoadUnverifiedKeys ¶
func (k KeybaseServiceMeasured) LoadUnverifiedKeys(ctx context.Context, uid keybase1.UID) ( keys []keybase1.PublicKey, err error)
LoadUnverifiedKeys implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) LoadUserPlusKeys ¶
func (k KeybaseServiceMeasured) LoadUserPlusKeys(ctx context.Context, uid keybase1.UID) ( userInfo UserInfo, err error)
LoadUserPlusKeys implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) Notify ¶
func (k KeybaseServiceMeasured) Notify(ctx context.Context, notification *keybase1.FSNotification) (err error)
Notify implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) Resolve ¶
func (k KeybaseServiceMeasured) Resolve(ctx context.Context, assertion string) ( name libkb.NormalizedUsername, uid keybase1.UID, err error)
Resolve implements the KeybaseService interface for KeybaseServiceMeasured.
func (KeybaseServiceMeasured) Shutdown ¶
func (k KeybaseServiceMeasured) Shutdown()
Shutdown implements the KeybaseService interface for KeybaseServiceMeasured.
type LocalUser ¶
type LocalUser struct {
UserInfo
Asserts []string
// Index into UserInfo.CryptPublicKeys.
CurrentCryptPublicKeyIndex int
// Index into UserInfo.VerifyingKeys.
CurrentVerifyingKeyIndex int
// Unverified keys.
UnverifiedKeys []keybase1.PublicKey
}
LocalUser represents a fake KBFS user, useful for testing.
func MakeLocalUsers ¶
func MakeLocalUsers(users []libkb.NormalizedUsername) []LocalUser
MakeLocalUsers is a helper function to generate a list of LocalUsers suitable to use with KBPKILocal.
func (*LocalUser) GetCurrentCryptPublicKey ¶
func (lu *LocalUser) GetCurrentCryptPublicKey() CryptPublicKey
GetCurrentCryptPublicKey returns this LocalUser's public encryption key.
func (*LocalUser) GetCurrentVerifyingKey ¶
func (lu *LocalUser) GetCurrentVerifyingKey() VerifyingKey
GetCurrentVerifyingKey returns this LocalUser's public signing key.
func (*LocalUser) GetPublicKeys ¶
GetPublicKeys returns all of this LocalUser's public encryption keys.
type MDCache ¶
type MDCache interface {
// Get gets the metadata object associated with the given TlfID,
// revision number, and branch ID (NullBranchID for merged MD).
Get(tlf TlfID, rev MetadataRevision, bid BranchID) (ImmutableRootMetadata, error)
// Put stores the metadata object.
Put(md ImmutableRootMetadata) error
}
MDCache gets and puts plaintext top-level metadata into the cache.
type MDCacheStandard ¶
type MDCacheStandard struct {
// contains filtered or unexported fields
}
MDCacheStandard implements a simple LRU cache for per-folder metadata objects.
func NewMDCacheStandard ¶
func NewMDCacheStandard(capacity int) *MDCacheStandard
NewMDCacheStandard constructs a new MDCacheStandard using the given cache capacity.
func (*MDCacheStandard) Get ¶
func (md *MDCacheStandard) Get(tlf TlfID, rev MetadataRevision, bid BranchID) ( ImmutableRootMetadata, error)
Get implements the MDCache interface for MDCacheStandard.
func (*MDCacheStandard) Put ¶
func (md *MDCacheStandard) Put(rmd ImmutableRootMetadata) error
Put implements the MDCache interface for MDCacheStandard.
type MDDiskUsageMismatch ¶
type MDDiskUsageMismatch struct {
// contains filtered or unexported fields
}
MDDiskUsageMismatch indicates an inconsistency in the DiskUsage field of a RootMetadata object.
func (MDDiskUsageMismatch) Error ¶
func (e MDDiskUsageMismatch) Error() string
type MDJournalConflictError ¶
type MDJournalConflictError struct{}
MDJournalConflictError is an error that is returned when a put detects a rewritten journal.
func (MDJournalConflictError) Error ¶
func (e MDJournalConflictError) Error() string
type MDMismatchError ¶
type MDMismatchError struct {
Revision MetadataRevision
Dir string
TlfID TlfID
Err error
}
MDMismatchError indicates an inconsistent or unverifiable MD object for the given top-level folder.
func (MDMismatchError) Error ¶
func (e MDMismatchError) Error() string
Error implements the error interface for MDMismatchError
type MDMissingDataError ¶
type MDMissingDataError struct {
ID TlfID
}
MDMissingDataError indicates that we are trying to take get the metadata ID of a MD object with no serialized data field.
func (MDMissingDataError) Error ¶
func (e MDMissingDataError) Error() string
Error implements the error interface for MDMissingDataError
type MDOps ¶
type MDOps interface {
// GetForHandle returns the current metadata object
// corresponding to the given top-level folder's handle and
// merge status, if the logged-in user has read permission on
// the folder. It creates the folder if one doesn't exist
// yet, and the logged-in user has permission to do so.
GetForHandle(
ctx context.Context, handle *TlfHandle, mStatus MergeStatus) (
TlfID, ImmutableRootMetadata, error)
// GetForTLF returns the current metadata object
// corresponding to the given top-level folder, if the logged-in
// user has read permission on the folder.
GetForTLF(ctx context.Context, id TlfID) (ImmutableRootMetadata, error)
// GetUnmergedForTLF is the same as the above but for unmerged
// metadata.
GetUnmergedForTLF(ctx context.Context, id TlfID, bid BranchID) (
ImmutableRootMetadata, error)
// GetRange returns a range of metadata objects corresponding to
// the passed revision numbers (inclusive).
GetRange(ctx context.Context, id TlfID, start, stop MetadataRevision) (
[]ImmutableRootMetadata, error)
// GetUnmergedRange is the same as the above but for unmerged
// metadata history (inclusive).
GetUnmergedRange(ctx context.Context, id TlfID, bid BranchID,
start, stop MetadataRevision) ([]ImmutableRootMetadata, error)
// Put stores the metadata object for the given
// top-level folder.
Put(ctx context.Context, rmd *RootMetadata) (MdID, error)
// PutUnmerged is the same as the above but for unmerged
// metadata history.
PutUnmerged(ctx context.Context, rmd *RootMetadata) (MdID, error)
// PruneBranch prunes all unmerged history for the given TLF
// branch.
PruneBranch(ctx context.Context, id TlfID, bid BranchID) error
// GetLatestHandleForTLF returns the server's idea of the latest handle for the TLF,
// which may not yet be reflected in the MD if the TLF hasn't been rekeyed since it
// entered into a conflicting state.
GetLatestHandleForTLF(ctx context.Context, id TlfID) (
BareTlfHandle, error)
}
MDOps gets and puts root metadata to an MDServer. On a get, it verifies the metadata is signed by the metadata's signing key.
type MDOpsStandard ¶
type MDOpsStandard struct {
// contains filtered or unexported fields
}
MDOpsStandard provides plaintext RootMetadata objects to upper layers, and processes RootMetadataSigned objects (encrypted and signed) suitable for passing to/from the MDServer backend.
func NewMDOpsStandard ¶
func NewMDOpsStandard(config Config) *MDOpsStandard
NewMDOpsStandard returns a new MDOpsStandard
func (*MDOpsStandard) GetForHandle ¶
func (md *MDOpsStandard) GetForHandle(ctx context.Context, handle *TlfHandle, mStatus MergeStatus) (TlfID, ImmutableRootMetadata, error)
GetForHandle implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetForTLF ¶
func (md *MDOpsStandard) GetForTLF(ctx context.Context, id TlfID) ( ImmutableRootMetadata, error)
GetForTLF implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetLatestHandleForTLF ¶
func (md *MDOpsStandard) GetLatestHandleForTLF(ctx context.Context, id TlfID) ( BareTlfHandle, error)
GetLatestHandleForTLF implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetRange ¶
func (md *MDOpsStandard) GetRange(ctx context.Context, id TlfID, start, stop MetadataRevision) ([]ImmutableRootMetadata, error)
GetRange implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetUnmergedForTLF ¶
func (md *MDOpsStandard) GetUnmergedForTLF( ctx context.Context, id TlfID, bid BranchID) ( ImmutableRootMetadata, error)
GetUnmergedForTLF implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetUnmergedRange ¶
func (md *MDOpsStandard) GetUnmergedRange(ctx context.Context, id TlfID, bid BranchID, start, stop MetadataRevision) ([]ImmutableRootMetadata, error)
GetUnmergedRange implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) PruneBranch ¶
PruneBranch implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) Put ¶
func (md *MDOpsStandard) Put( ctx context.Context, rmd *RootMetadata) (MdID, error)
Put implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) PutUnmerged ¶
func (md *MDOpsStandard) PutUnmerged( ctx context.Context, rmd *RootMetadata) (MdID, error)
PutUnmerged implements the MDOps interface for MDOpsStandard.
type MDPrevRootMismatch ¶
type MDPrevRootMismatch struct {
// contains filtered or unexported fields
}
MDPrevRootMismatch indicates that the PrevRoot field of a successor MD doesn't match the metadata ID of its predecessor.
func (MDPrevRootMismatch) Error ¶
func (e MDPrevRootMismatch) Error() string
type MDRevisionMismatch ¶
type MDRevisionMismatch struct {
// contains filtered or unexported fields
}
MDRevisionMismatch indicates that we tried to apply a revision that was not the next in line.
func (MDRevisionMismatch) Error ¶
func (e MDRevisionMismatch) Error() string
Error implements the error interface for MDRevisionMismatch.
type MDServer ¶
type MDServer interface {
AuthTokenRefreshHandler
// GetForHandle returns the current (signed/encrypted) metadata
// object corresponding to the given top-level folder's handle, if
// the logged-in user has read permission on the folder. It
// creates the folder if one doesn't exist yet, and the logged-in
// user has permission to do so.
GetForHandle(ctx context.Context, handle BareTlfHandle,
mStatus MergeStatus) (TlfID, *RootMetadataSigned, error)
// GetForTLF returns the current (signed/encrypted) metadata object
// corresponding to the given top-level folder, if the logged-in
// user has read permission on the folder.
GetForTLF(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus) (
*RootMetadataSigned, error)
// GetRange returns a range of (signed/encrypted) metadata objects
// corresponding to the passed revision numbers (inclusive).
GetRange(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus,
start, stop MetadataRevision) ([]*RootMetadataSigned, error)
// Put stores the (signed/encrypted) metadata object for the given
// top-level folder. Note: If the unmerged bit is set in the metadata
// block's flags bitmask it will be appended to the unmerged per-device
// history.
Put(ctx context.Context, rmds *RootMetadataSigned) error
// PruneBranch prunes all unmerged history for the given TLF branch.
PruneBranch(ctx context.Context, id TlfID, bid BranchID) error
// RegisterForUpdate tells the MD server to inform the caller when
// there is a merged update with a revision number greater than
// currHead, which did NOT originate from this same MD server
// session. This method returns a chan which can receive only a
// single error before it's closed. If the received err is nil,
// then there is updated MD ready to fetch which didn't originate
// locally; if it is non-nil, then the previous registration
// cannot send the next notification (e.g., the connection to the
// MD server may have failed). In either case, the caller must
// re-register to get a new chan that can receive future update
// notifications.
RegisterForUpdate(ctx context.Context, id TlfID,
currHead MetadataRevision) (<-chan error, error)
// CheckForRekeys initiates the rekey checking process on the
// server. The server is allowed to delay this request, and so it
// returns a channel for returning the error. Actual rekey
// requests are expected to come in asynchronously.
CheckForRekeys(ctx context.Context) <-chan error
// TruncateLock attempts to take the history truncation lock for
// this folder, for a TTL defined by the server. Returns true if
// the lock was successfully taken.
TruncateLock(ctx context.Context, id TlfID) (bool, error)
// TruncateUnlock attempts to release the history truncation lock
// for this folder. Returns true if the lock was successfully
// released.
TruncateUnlock(ctx context.Context, id TlfID) (bool, error)
// DisableRekeyUpdatesForTesting disables processing rekey updates
// received from the mdserver while testing.
DisableRekeyUpdatesForTesting()
// Shutdown is called to shutdown an MDServer connection.
Shutdown()
// IsConnected returns whether the MDServer is connected.
IsConnected() bool
// GetLatestHandleForTLF returns the server's idea of the latest handle for the TLF,
// which may not yet be reflected in the MD if the TLF hasn't been rekeyed since it
// entered into a conflicting state. For the highest level of confidence, the caller
// should verify the mapping with a Merkle tree lookup.
GetLatestHandleForTLF(ctx context.Context, id TlfID) (
BareTlfHandle, error)
// OffsetFromServerTime is the current estimate for how off our
// local clock is from the mdserver clock. Add this to any
// mdserver-provided timestamps to get the "local" time of the
// corresponding event. If the returned bool is false, then we
// don't have a current estimate for the offset.
OffsetFromServerTime() (time.Duration, bool)
}
MDServer gets and puts metadata for each top-level directory. The instantiation should be able to fetch session/user details via KBPKI. On a put, the server is responsible for 1) ensuring the user has appropriate permissions for whatever modifications were made; 2) ensuring that LastModifyingWriter and LastModifyingUser are updated appropriately; and 3) detecting conflicting writes based on the previous root block ID (i.e., when it supports strict consistency). On a get, it verifies the logged-in user has read permissions.
TODO: Add interface for searching by time
type MDServerDisconnected ¶
type MDServerDisconnected struct {
}
MDServerDisconnected indicates the MDServer has been disconnected for clients waiting on an update channel.
func (MDServerDisconnected) Error ¶
func (e MDServerDisconnected) Error() string
Error implements the error interface for MDServerDisconnected.
type MDServerDisk ¶
type MDServerDisk struct {
// contains filtered or unexported fields
}
MDServerDisk stores all info on disk, either in levelDBs, or disk journals and flat files for the actual MDs.
func NewMDServerDir ¶
func NewMDServerDir(config Config, dirPath string) (*MDServerDisk, error)
NewMDServerDir constructs a new MDServerDisk that stores its data in the given directory.
func NewMDServerTempDir ¶
func NewMDServerTempDir(config Config) (*MDServerDisk, error)
NewMDServerTempDir constructs a new MDServerDisk that stores its data in a temp directory which is cleaned up on shutdown.
func (*MDServerDisk) CheckForRekeys ¶
func (md *MDServerDisk) CheckForRekeys(ctx context.Context) <-chan error
CheckForRekeys implements the MDServer interface.
func (*MDServerDisk) DisableRekeyUpdatesForTesting ¶
func (md *MDServerDisk) DisableRekeyUpdatesForTesting()
DisableRekeyUpdatesForTesting implements the MDServer interface.
func (*MDServerDisk) GetForHandle ¶
func (md *MDServerDisk) GetForHandle(ctx context.Context, handle BareTlfHandle, mStatus MergeStatus) (TlfID, *RootMetadataSigned, error)
GetForHandle implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) GetForTLF ¶
func (md *MDServerDisk) GetForTLF(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
GetForTLF implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) GetLatestHandleForTLF ¶
func (md *MDServerDisk) GetLatestHandleForTLF(_ context.Context, id TlfID) ( BareTlfHandle, error)
GetLatestHandleForTLF implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) GetRange ¶
func (md *MDServerDisk) GetRange(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus, start, stop MetadataRevision) ( []*RootMetadataSigned, error)
GetRange implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) IsConnected ¶
func (md *MDServerDisk) IsConnected() bool
IsConnected implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) OffsetFromServerTime ¶
func (md *MDServerDisk) OffsetFromServerTime() (time.Duration, bool)
OffsetFromServerTime implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) PruneBranch ¶
PruneBranch implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) Put ¶
func (md *MDServerDisk) Put(ctx context.Context, rmds *RootMetadataSigned) error
Put implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) RefreshAuthToken ¶
func (md *MDServerDisk) RefreshAuthToken(ctx context.Context)
RefreshAuthToken implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) RegisterForUpdate ¶
func (md *MDServerDisk) RegisterForUpdate(ctx context.Context, id TlfID, currHead MetadataRevision) (<-chan error, error)
RegisterForUpdate implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) Shutdown ¶
func (md *MDServerDisk) Shutdown()
Shutdown implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) TruncateLock ¶
TruncateLock implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) TruncateUnlock ¶
TruncateUnlock implements the MDServer interface for MDServerDisk.
type MDServerError ¶
type MDServerError struct {
Err error
}
MDServerError is a generic server-side error.
func (MDServerError) Error ¶
func (e MDServerError) Error() string
Error implements the Error interface for MDServerError.
func (MDServerError) ToStatus ¶
func (e MDServerError) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerError.
type MDServerErrorBadRequest ¶
type MDServerErrorBadRequest struct {
Reason string
}
MDServerErrorBadRequest is a generic client-side error.
func (MDServerErrorBadRequest) Error ¶
func (e MDServerErrorBadRequest) Error() string
Error implements the Error interface for MDServerErrorBadRequest.
func (MDServerErrorBadRequest) ToStatus ¶
func (e MDServerErrorBadRequest) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorBadRequest.
type MDServerErrorConditionFailed ¶
type MDServerErrorConditionFailed struct {
Err error
}
MDServerErrorConditionFailed is returned when a conditonal write failed. This means there was a race and the caller should consider it a conflcit.
func (MDServerErrorConditionFailed) Error ¶
func (e MDServerErrorConditionFailed) Error() string
Error implements the Error interface for MDServerErrorConditionFailed.
func (MDServerErrorConditionFailed) ToStatus ¶
func (e MDServerErrorConditionFailed) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorConditionFailed.
type MDServerErrorConflictDiskUsage ¶
MDServerErrorConflictDiskUsage is returned when the passed MD block is inconsistent with current history.
func (MDServerErrorConflictDiskUsage) Error ¶
func (e MDServerErrorConflictDiskUsage) Error() string
Error implements the Error interface for MDServerErrorConflictDiskUsage
func (MDServerErrorConflictDiskUsage) ToStatus ¶
func (e MDServerErrorConflictDiskUsage) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorConflictDiskUsage.
type MDServerErrorConflictFolderMapping ¶
MDServerErrorConflictFolderMapping is returned when there is a folder handle to folder ID mapping mismatch.
func (MDServerErrorConflictFolderMapping) Error ¶
func (e MDServerErrorConflictFolderMapping) Error() string
Error implements the Error interface for MDServerErrorConflictFolderMapping.
func (MDServerErrorConflictFolderMapping) ToStatus ¶
func (e MDServerErrorConflictFolderMapping) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorConflictFolderMapping
type MDServerErrorConflictPrevRoot ¶
MDServerErrorConflictPrevRoot is returned when the passed MD block is inconsistent with current history.
func (MDServerErrorConflictPrevRoot) Error ¶
func (e MDServerErrorConflictPrevRoot) Error() string
Error implements the Error interface for MDServerErrorConflictPrevRoot.
func (MDServerErrorConflictPrevRoot) ToStatus ¶
func (e MDServerErrorConflictPrevRoot) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorConflictPrevRoot.
type MDServerErrorConflictRevision ¶
type MDServerErrorConflictRevision struct {
Desc string
Expected MetadataRevision
Actual MetadataRevision
}
MDServerErrorConflictRevision is returned when the passed MD block is inconsistent with current history.
func (MDServerErrorConflictRevision) Error ¶
func (e MDServerErrorConflictRevision) Error() string
Error implements the Error interface for MDServerErrorConflictRevision.
func (MDServerErrorConflictRevision) ToStatus ¶
func (e MDServerErrorConflictRevision) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorConflictRevision.
type MDServerErrorLocked ¶
type MDServerErrorLocked struct {
}
MDServerErrorLocked is returned when the folder truncation lock is acquired by someone else.
func (MDServerErrorLocked) Error ¶
func (e MDServerErrorLocked) Error() string
Error implements the Error interface for MDServerErrorLocked.
func (MDServerErrorLocked) ToStatus ¶
func (e MDServerErrorLocked) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorLocked.
type MDServerErrorThrottle ¶
type MDServerErrorThrottle struct {
Err error
}
MDServerErrorThrottle is returned when the server wants the client to backoff.
func (MDServerErrorThrottle) Error ¶
func (e MDServerErrorThrottle) Error() string
Error implements the Error interface for MDServerErrorThrottle.
func (MDServerErrorThrottle) ToStatus ¶
func (e MDServerErrorThrottle) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorThrottle.
type MDServerErrorUnauthorized ¶
type MDServerErrorUnauthorized struct {
}
MDServerErrorUnauthorized is returned when a device requests a key half which doesn't belong to it.
func (MDServerErrorUnauthorized) Errno ¶
func (e MDServerErrorUnauthorized) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for MDServerErrorUnauthorized.
func (MDServerErrorUnauthorized) Error ¶
func (e MDServerErrorUnauthorized) Error() string
Error implements the Error interface for MDServerErrorUnauthorized.
func (MDServerErrorUnauthorized) ToStatus ¶
func (e MDServerErrorUnauthorized) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorUnauthorized.
type MDServerErrorUnwrapper ¶
type MDServerErrorUnwrapper struct{}
MDServerErrorUnwrapper is an implementation of rpc.ErrorUnwrapper for errors coming from the MDServer.
func (MDServerErrorUnwrapper) MakeArg ¶
func (eu MDServerErrorUnwrapper) MakeArg() interface{}
MakeArg implements rpc.ErrorUnwrapper for MDServerErrorUnwrapper.
func (MDServerErrorUnwrapper) UnwrapError ¶
func (eu MDServerErrorUnwrapper) UnwrapError(arg interface{}) (appError error, dispatchError error)
UnwrapError implements rpc.ErrorUnwrapper for MDServerErrorUnwrapper.
type MDServerErrorWriteAccess ¶
type MDServerErrorWriteAccess struct{}
MDServerErrorWriteAccess is returned when the client isn't authorized to write to a TLF.
func (MDServerErrorWriteAccess) Errno ¶
func (e MDServerErrorWriteAccess) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for MDServerErrorWriteAccess.
func (MDServerErrorWriteAccess) Error ¶
func (e MDServerErrorWriteAccess) Error() string
Error implements the Error interface for MDServerErrorWriteAccess.
func (MDServerErrorWriteAccess) ToStatus ¶
func (e MDServerErrorWriteAccess) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorWriteAccess.
type MDServerMemory ¶
type MDServerMemory struct {
// contains filtered or unexported fields
}
MDServerMemory just stores metadata objects in memory.
func NewMDServerMemory ¶
func NewMDServerMemory(config Config) (*MDServerMemory, error)
NewMDServerMemory constructs a new MDServerMemory object that stores all data in-memory.
func (*MDServerMemory) CheckForRekeys ¶
func (md *MDServerMemory) CheckForRekeys(ctx context.Context) <-chan error
CheckForRekeys implements the MDServer interface.
func (*MDServerMemory) DisableRekeyUpdatesForTesting ¶
func (md *MDServerMemory) DisableRekeyUpdatesForTesting()
DisableRekeyUpdatesForTesting implements the MDServer interface.
func (*MDServerMemory) GetForHandle ¶
func (md *MDServerMemory) GetForHandle(ctx context.Context, handle BareTlfHandle, mStatus MergeStatus) (TlfID, *RootMetadataSigned, error)
GetForHandle implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) GetForTLF ¶
func (md *MDServerMemory) GetForTLF(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
GetForTLF implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) GetLatestHandleForTLF ¶
func (md *MDServerMemory) GetLatestHandleForTLF(_ context.Context, id TlfID) ( BareTlfHandle, error)
GetLatestHandleForTLF implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) GetRange ¶
func (md *MDServerMemory) GetRange(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus, start, stop MetadataRevision) ( []*RootMetadataSigned, error)
GetRange implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) IsConnected ¶
func (md *MDServerMemory) IsConnected() bool
IsConnected implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) OffsetFromServerTime ¶
func (md *MDServerMemory) OffsetFromServerTime() (time.Duration, bool)
OffsetFromServerTime implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) PruneBranch ¶
PruneBranch implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) Put ¶
func (md *MDServerMemory) Put(ctx context.Context, rmds *RootMetadataSigned) error
Put implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) RefreshAuthToken ¶
func (md *MDServerMemory) RefreshAuthToken(ctx context.Context)
RefreshAuthToken implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) RegisterForUpdate ¶
func (md *MDServerMemory) RegisterForUpdate(ctx context.Context, id TlfID, currHead MetadataRevision) (<-chan error, error)
RegisterForUpdate implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) Shutdown ¶
func (md *MDServerMemory) Shutdown()
Shutdown implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) TruncateLock ¶
TruncateLock implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) TruncateUnlock ¶
TruncateUnlock implements the MDServer interface for MDServerMemory.
type MDServerRemote ¶
type MDServerRemote struct {
// contains filtered or unexported fields
}
MDServerRemote is an implementation of the MDServer interface.
func NewMDServerRemote ¶
func NewMDServerRemote(config Config, srvAddr string, ctx Context) *MDServerRemote
NewMDServerRemote returns a new instance of MDServerRemote.
func (*MDServerRemote) CheckForRekeys ¶
func (md *MDServerRemote) CheckForRekeys(ctx context.Context) <-chan error
CheckForRekeys implements the MDServer interface.
func (*MDServerRemote) DeleteTLFCryptKeyServerHalf ¶
func (md *MDServerRemote) DeleteTLFCryptKeyServerHalf(ctx context.Context, uid keybase1.UID, kid keybase1.KID, serverHalfID TLFCryptKeyServerHalfID) error
DeleteTLFCryptKeyServerHalf is an implementation of the KeyServer interface.
func (*MDServerRemote) DisableRekeyUpdatesForTesting ¶
func (md *MDServerRemote) DisableRekeyUpdatesForTesting()
DisableRekeyUpdatesForTesting implements the MDServer interface.
func (*MDServerRemote) FolderNeedsRekey ¶
func (md *MDServerRemote) FolderNeedsRekey(_ context.Context, arg keybase1.FolderNeedsRekeyArg) error
FolderNeedsRekey implements the MetadataUpdateProtocol interface.
func (*MDServerRemote) GetForHandle ¶
func (md *MDServerRemote) GetForHandle(ctx context.Context, handle BareTlfHandle, mStatus MergeStatus) ( TlfID, *RootMetadataSigned, error)
GetForHandle implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) GetForTLF ¶
func (md *MDServerRemote) GetForTLF(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
GetForTLF implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) GetLatestHandleForTLF ¶
func (md *MDServerRemote) GetLatestHandleForTLF(ctx context.Context, id TlfID) ( BareTlfHandle, error)
GetLatestHandleForTLF implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) GetRange ¶
func (md *MDServerRemote) GetRange(ctx context.Context, id TlfID, bid BranchID, mStatus MergeStatus, start, stop MetadataRevision) ( []*RootMetadataSigned, error)
GetRange implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) GetTLFCryptKeyServerHalf ¶
func (md *MDServerRemote) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, cryptKey CryptPublicKey) (serverHalf TLFCryptKeyServerHalf, err error)
GetTLFCryptKeyServerHalf is an implementation of the KeyServer interface.
func (*MDServerRemote) HandlerName ¶
func (*MDServerRemote) HandlerName() string
HandlerName implements the ConnectionHandler interface.
func (*MDServerRemote) IsConnected ¶
func (md *MDServerRemote) IsConnected() bool
IsConnected implements the MDServer interface for MDServerLocal
func (*MDServerRemote) MetadataUpdate ¶
func (md *MDServerRemote) MetadataUpdate(_ context.Context, arg keybase1.MetadataUpdateArg) error
MetadataUpdate implements the MetadataUpdateProtocol interface.
func (*MDServerRemote) OffsetFromServerTime ¶
func (md *MDServerRemote) OffsetFromServerTime() (time.Duration, bool)
OffsetFromServerTime implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) OnConnect ¶
func (md *MDServerRemote) OnConnect(ctx context.Context, conn *rpc.Connection, client rpc.GenericClient, server *rpc.Server) (err error)
OnConnect implements the ConnectionHandler interface.
func (*MDServerRemote) OnConnectError ¶
func (md *MDServerRemote) OnConnectError(err error, wait time.Duration)
OnConnectError implements the ConnectionHandler interface.
func (*MDServerRemote) OnDisconnected ¶
func (md *MDServerRemote) OnDisconnected(ctx context.Context, status rpc.DisconnectStatus)
OnDisconnected implements the ConnectionHandler interface.
func (*MDServerRemote) OnDoCommandError ¶
func (md *MDServerRemote) OnDoCommandError(err error, wait time.Duration)
OnDoCommandError implements the ConnectionHandler interface.
func (*MDServerRemote) PruneBranch ¶
PruneBranch implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) Put ¶
func (md *MDServerRemote) Put(ctx context.Context, rmds *RootMetadataSigned) error
Put implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) PutTLFCryptKeyServerHalves ¶
func (md *MDServerRemote) PutTLFCryptKeyServerHalves(ctx context.Context, serverKeyHalves map[keybase1.UID]map[keybase1.KID]TLFCryptKeyServerHalf) error
PutTLFCryptKeyServerHalves is an implementation of the KeyServer interface.
func (*MDServerRemote) RefreshAuthToken ¶
func (md *MDServerRemote) RefreshAuthToken(ctx context.Context)
RefreshAuthToken implements the AuthTokenRefreshHandler interface.
func (*MDServerRemote) RegisterForUpdate ¶
func (md *MDServerRemote) RegisterForUpdate(ctx context.Context, id TlfID, currHead MetadataRevision) (<-chan error, error)
RegisterForUpdate implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) RemoteAddress ¶
func (md *MDServerRemote) RemoteAddress() string
RemoteAddress returns the remote mdserver this client is talking to
func (*MDServerRemote) ShouldRetry ¶
func (md *MDServerRemote) ShouldRetry(name string, err error) bool
ShouldRetry implements the ConnectionHandler interface.
func (*MDServerRemote) ShouldRetryOnConnect ¶
func (md *MDServerRemote) ShouldRetryOnConnect(err error) bool
ShouldRetryOnConnect implements the ConnectionHandler interface.
func (*MDServerRemote) Shutdown ¶
func (md *MDServerRemote) Shutdown()
Shutdown implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) TruncateLock ¶
TruncateLock implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) TruncateUnlock ¶
TruncateUnlock implements the MDServer interface for MDServerRemote.
type MDTlfIDMismatch ¶
type MDTlfIDMismatch struct {
// contains filtered or unexported fields
}
MDTlfIDMismatch indicates that the ID field of a successor MD doesn't match the ID field of its predecessor.
func (MDTlfIDMismatch) Error ¶
func (e MDTlfIDMismatch) Error() string
type MDUpdateInvertError ¶
type MDUpdateInvertError struct {
// contains filtered or unexported fields
}
MDUpdateInvertError indicates that we tried to apply a revision that was not the next in line.
func (MDUpdateInvertError) Error ¶
func (e MDUpdateInvertError) Error() string
Error implements the error interface for MDUpdateInvertError.
type MDWriteNeededInRequest ¶
type MDWriteNeededInRequest struct {
}
MDWriteNeededInRequest indicates that the system needs MD write permissions to successfully complete an operation, so it should retry in mdWrite mode.
func (MDWriteNeededInRequest) Error ¶
func (e MDWriteNeededInRequest) Error() string
Error implements the error interface for MDWriteNeededInRequest
type MdID ¶
type MdID struct {
// contains filtered or unexported fields
}
MdID is the content-based ID for a metadata block.
func MdIDFromBytes ¶
MdIDFromBytes creates a new MdID from the given bytes. If the returned error is nil, the returned MdID is valid.
func (MdID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for MdID. Returns an error if the MdID is invalid and not the zero MdID.
func (*MdID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for MdID. Returns an error if the given byte array is non-empty and the MdID is invalid.
type MergeStatus ¶
type MergeStatus int
MergeStatus represents the merge status of a TLF.
const ( // Merged means that the TLF is merged and no conflict // resolution needs to be done. Merged MergeStatus = iota // Unmerged means that the TLF is unmerged and conflict // resolution needs to be done. Metadata blocks which // represent unmerged history should have a non-null // branch ID defined. Unmerged )
func (MergeStatus) String ¶
func (m MergeStatus) String() string
type MerkleHash ¶
type MerkleHash struct {
// contains filtered or unexported fields
}
MerkleHash is the hash of a RootMetadataSigned block.
func MerkleHashFromBytes ¶
func MerkleHashFromBytes(data []byte) (MerkleHash, error)
MerkleHashFromBytes creates a new MerkleHash from the given bytes. If the returned error is nil, the returned MerkleHash is valid.
func (MerkleHash) Bytes ¶
func (h MerkleHash) Bytes() []byte
Bytes returns the bytes of the MerkleHash.
func (MerkleHash) MarshalBinary ¶
func (h MerkleHash) MarshalBinary() (data []byte, err error)
MarshalBinary implements the encoding.BinaryMarshaler interface for MerkleHash. Returns an error if the MerkleHash is invalid and not the zero MerkleHash.
func (MerkleHash) String ¶
func (h MerkleHash) String() string
String returns the string form of the MerkleHash.
func (*MerkleHash) UnmarshalBinary ¶
func (h *MerkleHash) UnmarshalBinary(data []byte) error
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for MerkleHash. Returns an error if the given byte array is non-empty and the MerkleHash is invalid.
type MerkleLeaf ¶
type MerkleLeaf struct {
Revision MetadataRevision
Hash MerkleHash // hash of the signed metadata object
Timestamp int64
// contains filtered or unexported fields
}
MerkleLeaf is the value of a Merkle leaf node.
func (MerkleLeaf) Construct ¶
func (l MerkleLeaf) Construct() interface{}
Construct implements the go-merkle-tree.ValueConstructor interface.
type MerkleRoot ¶
type MerkleRoot struct {
Version int `codec:"v"`
TreeID keybase1.MerkleTreeID `codec:"t"`
SeqNo int64 `codec:"sn"`
Timestamp int64 `codec:"ts"`
Hash merkle.Hash `codec:"h"`
PrevRoot merkle.Hash `codec:"pr"`
EPubKey *TLFEphemeralPublicKey `codec:"epk,omitempty"` // these two are only necessary with encrypted leaves.
Nonce *[24]byte `codec:"non,omitempty"` // the public tree leaves are in the clear.
}
MerkleRoot represents a signed Merkle tree root.
type MetadataFlags ¶
type MetadataFlags byte
MetadataFlags bitfield.
const ( MetadataFlagRekey MetadataFlags = 1 << iota MetadataFlagWriterMetadataCopied MetadataFlagFinal )
Possible flags set in the MetadataFlags bitfield.
type MetadataIsFinalError ¶
type MetadataIsFinalError struct {
}
MetadataIsFinalError indicates that we tried to make or set a successor to a finalized folder.
func (MetadataIsFinalError) Error ¶
func (e MetadataIsFinalError) Error() string
Error implements the error interface for MetadataIsFinalError.
type MetadataRevision ¶
type MetadataRevision int64
MetadataRevision is the type for the revision number. This is currently int64 since that's the type of Avro's long.
func (MetadataRevision) Number ¶
func (mr MetadataRevision) Number() int64
Number casts a MetadataRevision to it's primitive type.
func (MetadataRevision) String ¶
func (mr MetadataRevision) String() string
String converts a MetadataRevision to its string form.
type MetadataVer ¶
type MetadataVer int
MetadataVer is the type of a version for marshalled KBFS metadata structures.
type MutableBareRootMetadata ¶
type MutableBareRootMetadata interface {
BareRootMetadata
// SetRefBytes sets the number of newly referenced bytes introduced by this revision of metadata.
SetRefBytes(refBytes uint64)
// SetUnrefBytes sets the number of newly unreferenced bytes introduced by this revision of metadata.
SetUnrefBytes(unrefBytes uint64)
// SetDiskUsage sets the estimated disk usage for the folder as of this revision of metadata.
SetDiskUsage(diskUsage uint64)
// AddRefBytes increments the number of newly referenced bytes introduced by this revision of metadata.
AddRefBytes(refBytes uint64)
// AddUnrefBytes increments the number of newly unreferenced bytes introduced by this revision of metadata.
AddUnrefBytes(unrefBytes uint64)
// AddDiskUsage increments the estimated disk usage for the folder as of this revision of metadata.
AddDiskUsage(diskUsage uint64)
// ClearRekeyBit unsets any set rekey bit.
ClearRekeyBit()
// ClearWriterMetadataCopiedBit unsets any set writer metadata copied bit.
ClearWriterMetadataCopiedBit()
// ClearFinalBit unsets any final bit.
ClearFinalBit()
// SetUnmerged sets the unmerged bit.
SetUnmerged()
// SetBranchID sets the branch ID for this metadata revision.
SetBranchID(bid BranchID)
// SetPrevRoot sets the hash of the previous metadata revision.
SetPrevRoot(mdID MdID)
// SetSerializedPrivateMetadata sets the serialized private metadata.
SetSerializedPrivateMetadata(spmd []byte)
// SetWriterMetadataSigInfo sets the signature info associated with the the writer metadata.
SetWriterMetadataSigInfo(sigInfo SignatureInfo)
// SetLastModifyingWriter sets the UID of the last user to modify the writer metadata.
SetLastModifyingWriter(user keybase1.UID)
// SetLastModifyingUser sets the UID of the last user to modify any of the metadata.
SetLastModifyingUser(user keybase1.UID)
// SetRekeyBit sets the rekey bit.
SetRekeyBit()
// SetFinalBit sets the finalized bit.
SetFinalBit()
// SetWriterMetadataCopiedBit set the writer metadata copied bit.
SetWriterMetadataCopiedBit()
// SetRevision sets the revision number of the underlying metadata.
SetRevision(revision MetadataRevision)
// AddNewKeys adds new writer and reader TLF key bundles to this revision of metadata.
AddNewKeys(wkb TLFWriterKeyBundle, rkb TLFReaderKeyBundle)
// SetUnresolvedReaders sets the list of unresolved readers assoiated with this folder.
SetUnresolvedReaders(readers []keybase1.SocialAssertion)
// SetUnresolvedWriters sets the list of unresolved writers assoiated with this folder.
SetUnresolvedWriters(writers []keybase1.SocialAssertion)
// SetConflictInfo sets any conflict info associated with this metadata revision.
SetConflictInfo(ci *TlfHandleExtension)
// SetFinalizedInfo sets any finalized info associated with this metadata revision.
SetFinalizedInfo(fi *TlfHandleExtension)
// SetWriters sets the list of writers associated with this folder.
SetWriters(writers []keybase1.UID)
// SetTlfID sets the ID of the underlying folder in the metadata structure.
SetTlfID(tlf TlfID)
// FakeInitialRekey fakes the initial rekey for the given
// BareRootMetadata. This is necessary since newly-created
// BareRootMetadata objects don't have enough data to build a
// TlfHandle from until the first rekey.
FakeInitialRekey(h BareTlfHandle)
// Update initializes the given freshly-created BareRootMetadata object with
// the given TlfID and BareTlfHandle. Note that if the given ID/handle are private,
// rekeying must be done separately.
// Update implements the BareRootMetadata interface for BareRootMetadataV2.
Update(tlf TlfID, h BareTlfHandle) error
// Returns the TLF key bundles for this metadata at the given key generation.
GetTLFKeyBundles(keyGen KeyGen) (*TLFWriterKeyBundle, *TLFReaderKeyBundle, error)
}
MutableBareRootMetadata is a mutable interface to the bare serializeable MD that is signed by the reader or writer.
type MutableBareRootMetadataNoImplError ¶
type MutableBareRootMetadataNoImplError struct {
}
MutableBareRootMetadataNoImplError is returned when an interface expected to implement MutableBareRootMetadata does not do so.
func (MutableBareRootMetadataNoImplError) Error ¶
func (e MutableBareRootMetadataNoImplError) Error() string
Error implements the error interface for MutableBareRootMetadataNoImplError
type NameExistsError ¶
type NameExistsError struct {
Name string
}
NameExistsError indicates that the user tried to create an entry for a name that already existed in a subdirectory.
func (NameExistsError) Error ¶
func (e NameExistsError) Error() string
Error implements the error interface for NameExistsError
type NameTooLongError ¶
type NameTooLongError struct {
// contains filtered or unexported fields
}
NameTooLongError indicates that the user tried to write a directory entry name that would be bigger than KBFS's supported size.
func (NameTooLongError) Errno ¶
func (e NameTooLongError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for NameTooLongError.
func (NameTooLongError) Error ¶
func (e NameTooLongError) Error() string
Error implements the error interface for NameTooLongError.
type NaïveStaller ¶
type NaïveStaller struct {
// contains filtered or unexported fields
}
NaïveStaller is used to stall certain ops in BlockOps or MDOps. Unlike StallBlockOp and StallMDOp which provides a way to precisely control which particular op is stalled by passing in ctx with corresponding stallKey, NaïveStaller simply stalls all instances of specified op.
func NewNaïveStaller ¶
func NewNaïveStaller(config Config) *NaïveStaller
NewNaïveStaller returns a new NaïveStaller
func (*NaïveStaller) StallBlockOp ¶
func (s *NaïveStaller) StallBlockOp(stalledOp StallableBlockOp)
StallBlockOp wraps the internal BlockOps so that all subsequent stalledOp will be stalled. This can be undone by calling UndoStallBlockOp.
func (*NaïveStaller) StallMDOp ¶
func (s *NaïveStaller) StallMDOp(stalledOp StallableMDOp)
StallMDOp wraps the internal MDOps so that all subsequent stalledOp will be stalled. This can be undone by calling UndoStallMDOp.
func (*NaïveStaller) UndoStallBlockOp ¶
func (s *NaïveStaller) UndoStallBlockOp(stalledOp StallableBlockOp)
UndoStallBlockOp reverts StallBlockOp so that future stalledOp are not stalled anymore. It also unstalls any stalled stalledOp. StallBlockOp should have been called upon stalledOp, otherwise this would panic.
func (*NaïveStaller) UndoStallMDOp ¶
func (s *NaïveStaller) UndoStallMDOp(stalledOp StallableMDOp)
UndoStallMDOp reverts StallMDOp so that future stalledOp are not stalled anymore. It also unstalls any stalled stalledOp. StallMDOp should have been called upon stalledOp, otherwise this would panic.
func (*NaïveStaller) UnstallOneBlockOp ¶
func (s *NaïveStaller) UnstallOneBlockOp(stalledOp StallableBlockOp)
UnstallOneBlockOp unstalls exactly one stalled stalledOp. StallBlockOp should have been called upon stalledOp, otherwise this would panic.
func (*NaïveStaller) UnstallOneMDOp ¶
func (s *NaïveStaller) UnstallOneMDOp(stalledOp StallableMDOp)
UnstallOneMDOp unstalls exactly one stalled stalledOp. StallMDOp should have been called upon stalledOp, otherwise this would panic.
func (*NaïveStaller) WaitForStallBlockOp ¶
func (s *NaïveStaller) WaitForStallBlockOp(stalledOp StallableBlockOp)
WaitForStallBlockOp blocks until stalledOp is stalled. StallBlockOp should have been called upon stalledOp, otherwise this would panic.
func (*NaïveStaller) WaitForStallMDOp ¶
func (s *NaïveStaller) WaitForStallMDOp(stalledOp StallableMDOp)
WaitForStallMDOp blocks until stalledOp is stalled. StallMDOp should have been called upon stalledOp, otherwise this would panic.
type NeedOtherRekeyError ¶
type NeedOtherRekeyError struct {
Tlf CanonicalTlfName
}
NeedOtherRekeyError indicates that the folder in question needs to be rekeyed for the local device, and can only done so by one of the other users.
func (NeedOtherRekeyError) Errno ¶
func (e NeedOtherRekeyError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for NeedOtherRekeyError.
func (NeedOtherRekeyError) Error ¶
func (e NeedOtherRekeyError) Error() string
Error implements the error interface for NeedOtherRekeyError
type NeedSelfRekeyError ¶
type NeedSelfRekeyError struct {
Tlf CanonicalTlfName
}
NeedSelfRekeyError indicates that the folder in question needs to be rekeyed for the local device, and can be done so by one of the other user's devices.
func (NeedSelfRekeyError) Errno ¶
func (e NeedSelfRekeyError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for NeedSelfRekeyError.
func (NeedSelfRekeyError) Error ¶
func (e NeedSelfRekeyError) Error() string
Error implements the error interface for NeedSelfRekeyError
type NewDataVersionError ¶
type NewDataVersionError struct {
DataVer DataVer
// contains filtered or unexported fields
}
NewDataVersionError indicates that the data at the given path has been written using a new data version that our client doesn't understand.
func (NewDataVersionError) Error ¶
func (e NewDataVersionError) Error() string
Error implements the error interface for NewDataVersionError.
type NewKeyGenerationError ¶
NewKeyGenerationError indicates that the data at the given path has been written using keys that our client doesn't have.
func (NewKeyGenerationError) Error ¶
func (e NewKeyGenerationError) Error() string
Error implements the error interface for NewKeyGenerationError.
type NewMetadataVersionError ¶
type NewMetadataVersionError struct {
Tlf TlfID
MetadataVer MetadataVer
}
NewMetadataVersionError indicates that the metadata for the given folder has been written using a new metadata version that our client doesn't understand.
func (NewMetadataVersionError) Error ¶
func (e NewMetadataVersionError) Error() string
Error implements the error interface for NewMetadataVersionError.
type NoChainFoundError ¶
type NoChainFoundError struct {
// contains filtered or unexported fields
}
NoChainFoundError indicates that a conflict resolution chain corresponding to the given pointer could not be found.
func (NoChainFoundError) Error ¶
func (e NoChainFoundError) Error() string
Error implements the error interface for NoChainFoundError.
type NoCurrentSessionError ¶
type NoCurrentSessionError struct {
}
NoCurrentSessionError indicates that the daemon has no current session. This is basically a wrapper for session.ErrNoSession, needed to give the correct return error code to the OS.
func (NoCurrentSessionError) Errno ¶
func (e NoCurrentSessionError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for NoCurrentSessionError.
func (NoCurrentSessionError) Error ¶
func (e NoCurrentSessionError) Error() string
Error implements the error interface for NoCurrentSessionError.
type NoKeysError ¶
type NoKeysError struct{}
NoKeysError indicates that no keys were provided for a decryption allowing multiple device keys
func (NoKeysError) Error ¶
func (e NoKeysError) Error() string
type NoSigChainError ¶
type NoSigChainError struct {
User libkb.NormalizedUsername
}
NoSigChainError means that a user we were trying to identify does not have a sigchain.
func (NoSigChainError) Error ¶
func (e NoSigChainError) Error() string
Error implements the error interface for NoSigChainError.
type NoSuchBlockError ¶
type NoSuchBlockError struct {
ID BlockID
}
NoSuchBlockError indicates that a block for the associated ID doesn't exist.
func (NoSuchBlockError) Error ¶
func (e NoSuchBlockError) Error() string
Error implements the error interface for NoSuchBlockError
type NoSuchFolderListError ¶
NoSuchFolderListError indicates that the user tried to access a subdirectory of /keybase that doesn't exist.
func (NoSuchFolderListError) Errno ¶
func (e NoSuchFolderListError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for NoSuchFolderListError
func (NoSuchFolderListError) Error ¶
func (e NoSuchFolderListError) Error() string
Error implements the error interface for NoSuchFolderListError
type NoSuchMDError ¶
type NoSuchMDError struct {
Tlf TlfID
Rev MetadataRevision
BID BranchID
}
NoSuchMDError indicates that there is no MD object for the given folder, revision, and merged status.
func (NoSuchMDError) Error ¶
func (e NoSuchMDError) Error() string
Error implements the error interface for NoSuchMDError
type NoSuchNameError ¶
type NoSuchNameError struct {
Name string
}
NoSuchNameError indicates that the user tried to access a subdirectory entry that doesn't exist.
func (NoSuchNameError) Error ¶
func (e NoSuchNameError) Error() string
Error implements the error interface for NoSuchNameError
type NoSuchTlfHandleError ¶
type NoSuchTlfHandleError struct {
ID TlfID
}
NoSuchTlfHandleError indicates we were unable to resolve a folder ID to a folder handle.
func (NoSuchTlfHandleError) Error ¶
func (e NoSuchTlfHandleError) Error() string
Error implements the error interface for NoSuchTlfHandleError
type NoSuchUserError ¶
type NoSuchUserError struct {
Input string
}
NoSuchUserError indicates that the given user couldn't be resolved.
func (NoSuchUserError) Errno ¶
func (e NoSuchUserError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for NoSuchUserError
func (NoSuchUserError) Error ¶
func (e NoSuchUserError) Error() string
Error implements the error interface for NoSuchUserError
func (NoSuchUserError) ToStatus ¶
func (e NoSuchUserError) ToStatus() keybase1.Status
ToStatus implements the keybase1.ToStatusAble interface for NoSuchUserError
type Node ¶
type Node interface {
// GetID returns the ID of this Node. This should be used as a
// map key instead of the Node itself.
GetID() NodeID
// GetFolderBranch returns the folder ID and branch for this Node.
GetFolderBranch() FolderBranch
// GetBasename returns the current basename of the node, or ""
// if the node has been unlinked.
GetBasename() string
}
Node represents a direct pointer to a file or directory in KBFS. It is somewhat like an inode in a regular file system. Users of KBFS can use Node as a handle when accessing files or directories they have previously looked up.
func GetRootNodeForTest ¶
GetRootNodeForTest gets the root node for the given TLF name, which must be canonical, creating it if necessary.
func GetRootNodeOrBust ¶
GetRootNodeOrBust gets the root node for the given TLF name, which must be canonical, creating it if necessary, and failing if there's an error.
type NodeCache ¶
type NodeCache interface {
// GetOrCreate either makes a new Node for the given
// BlockPointer, or returns an existing one. TODO: If we ever
// support hard links, we will have to revisit the "name" and
// "parent" parameters here. name must not be empty. Returns
// an error if parent cannot be found.
GetOrCreate(ptr BlockPointer, name string, parent Node) (Node, error)
// Get returns the Node associated with the given ptr if one
// already exists. Otherwise, it returns nil.
Get(ref blockRef) Node
// UpdatePointer updates the BlockPointer for the corresponding
// Node. NodeCache ignores this call when oldRef is not cached in
// any Node.
UpdatePointer(oldRef blockRef, newPtr BlockPointer)
// Move swaps the parent node for the corresponding Node, and
// updates the node's name. NodeCache ignores the call when ptr
// is not cached. Returns an error if newParent cannot be found.
// If newParent is nil, it treats the ptr's corresponding node as
// being unlinked from the old parent completely.
Move(ref blockRef, newParent Node, newName string) error
// Unlink set the corresponding node's parent to nil and caches
// the provided path in case the node is still open. NodeCache
// ignores the call when ptr is not cached. The path is required
// because the caller may have made changes to the parent nodes
// already that shouldn't be reflected in the cached path.
Unlink(ref blockRef, oldPath path)
// PathFromNode creates the path up to a given Node.
PathFromNode(node Node) path
}
NodeCache holds Nodes, and allows libkbfs to update them when things change about the underlying KBFS blocks. It is probably most useful to instantiate this on a per-folder-branch basis, so that it can create a Path with the correct DirId and Branch name.
type NodeChange ¶
type NodeChange struct {
Node Node
// Basenames of entries added/removed.
DirUpdated []string
FileUpdated []WriteRange
}
NodeChange represents a change made to a node as part of an atomic file system operation.
type NodeID ¶
type NodeID interface {
// ParentID returns the NodeID of the directory containing the
// pointed-to file or directory, or nil if none exists.
ParentID() NodeID
}
NodeID is a unique but transient ID for a Node. That is, two Node objects in memory at the same time represent the same file or directory if and only if their NodeIDs are equal (by pointer).
type NodeNotFoundError ¶
type NodeNotFoundError struct {
// contains filtered or unexported fields
}
NodeNotFoundError indicates that we tried to find a node for the given BlockPointer and failed.
func (NodeNotFoundError) Error ¶
func (e NodeNotFoundError) Error() string
Error implements the error interface for NodeNotFoundError.
type NotDirBlockError ¶
type NotDirBlockError struct {
// contains filtered or unexported fields
}
NotDirBlockError indicates that a file block was expected but a block of a different type was found.
ptr and branch should be filled in, but p may be empty.
func (NotDirBlockError) Error ¶
func (e NotDirBlockError) Error() string
type NotDirError ¶
type NotDirError struct {
// contains filtered or unexported fields
}
NotDirError indicates that the user tried to perform a dir-specific operation on something that isn't a directory.
func (NotDirError) Error ¶
func (e NotDirError) Error() string
Error implements the error interface for NotDirError
type NotDirectFileBlockError ¶
type NotDirectFileBlockError struct {
}
NotDirectFileBlockError indicates that a direct file block was expected, but something else (e.g., an indirect file block) was given instead.
func (NotDirectFileBlockError) Error ¶
func (e NotDirectFileBlockError) Error() string
type NotFileBlockError ¶
type NotFileBlockError struct {
// contains filtered or unexported fields
}
NotFileBlockError indicates that a file block was expected but a block of a different type was found.
ptr and branch should be filled in, but p may be empty.
func (NotFileBlockError) Error ¶
func (e NotFileBlockError) Error() string
type NotFileError ¶
type NotFileError struct {
// contains filtered or unexported fields
}
NotFileError indicates that the user tried to perform a file-specific operation on something that isn't a file.
func (NotFileError) Error ¶
func (e NotFileError) Error() string
Error implements the error interface for NotFileError
type NotPermittedWhileDirtyError ¶
type NotPermittedWhileDirtyError struct {
}
NotPermittedWhileDirtyError indicates that some operation failed because of outstanding dirty files, and may be retried later.
func (NotPermittedWhileDirtyError) Error ¶
func (e NotPermittedWhileDirtyError) Error() string
Error implements the error interface for NotPermittedWhileDirtyError.
type Notifier ¶
type Notifier interface {
// RegisterForChanges declares that the given Observer wants to
// subscribe to updates for the given top-level folders.
RegisterForChanges(folderBranches []FolderBranch, obs Observer) error
// UnregisterFromChanges declares that the given Observer no
// longer wants to subscribe to updates for the given top-level
// folders.
UnregisterFromChanges(folderBranches []FolderBranch, obs Observer) error
}
Notifier notifies registrants of directory changes
type Observer ¶
type Observer interface {
// LocalChange announces that the file at this Node has been
// updated locally, but not yet saved at the server.
LocalChange(ctx context.Context, node Node, write WriteRange)
// BatchChanges announces that the nodes have all been updated
// together atomically. Each NodeChange in changes affects the
// same top-level folder and branch.
BatchChanges(ctx context.Context, changes []NodeChange)
// TlfHandleChange announces that the handle of the corresponding
// folder branch has changed, likely due to previously-unresolved
// assertions becoming resolved. This indicates that the listener
// should switch over any cached paths for this folder-branch to
// the new name. Nodes that were acquired under the old name will
// still continue to work, but new lookups on the old name may
// either encounter alias errors or entirely new TLFs (in the case
// of conflicts).
TlfHandleChange(ctx context.Context, newHandle *TlfHandle)
}
Observer can be notified that there is an available update for a given directory. The notification callbacks should not block, or make any calls to the Notifier interface. Nodes passed to the observer should not be held past the end of the notification callback.
type OpCommon ¶
type OpCommon struct {
RefBlocks []BlockPointer `codec:"r,omitempty"`
UnrefBlocks []BlockPointer `codec:"u,omitempty"`
Updates []blockUpdate `codec:"o,omitempty"`
codec.UnknownFieldSetHandler
// contains filtered or unexported fields
}
OpCommon are data structures needed by all ops. It is only exported for serialization purposes.
func (*OpCommon) AddRefBlock ¶
func (oc *OpCommon) AddRefBlock(ptr BlockPointer)
AddRefBlock adds this block to the list of newly-referenced blocks for this op.
func (*OpCommon) AddUnrefBlock ¶
func (oc *OpCommon) AddUnrefBlock(ptr BlockPointer)
AddUnrefBlock adds this block to the list of newly-unreferenced blocks for this op.
func (*OpCommon) AddUpdate ¶
func (oc *OpCommon) AddUpdate(oldPtr BlockPointer, newPtr BlockPointer)
AddUpdate adds a mapping from an old block to the new version of that block, for this op.
func (*OpCommon) DelRefBlock ¶
func (oc *OpCommon) DelRefBlock(ptr BlockPointer)
DelRefBlock removes the first reference of the given block from the list of newly-referenced blocks for this op.
func (*OpCommon) Refs ¶
func (oc *OpCommon) Refs() []BlockPointer
Refs returns a slice containing all the blocks that were initially referenced during this op.
func (*OpCommon) Unrefs ¶
func (oc *OpCommon) Unrefs() []BlockPointer
Unrefs returns a slice containing all the blocks that were unreferenced during this op.
type OpSummary ¶
OpSummary describes the changes performed by a single op, and is suitable for encoding directly as JSON.
type OpsCantHandleFavorite ¶
type OpsCantHandleFavorite struct {
Msg string
}
OpsCantHandleFavorite means that folderBranchOps wasn't able to deal with a favorites request.
func (OpsCantHandleFavorite) Error ¶
func (e OpsCantHandleFavorite) Error() string
Error implements the error interface for OpsCantHandleFavorite.
type OutdatedVersionError ¶
type OutdatedVersionError struct {
}
OutdatedVersionError indicates that we have encountered some new data version we don't understand, and the user should be prompted to upgrade.
func (OutdatedVersionError) Error ¶
func (e OutdatedVersionError) Error() string
Error implements the error interface for OutdatedVersionError.
type OverQuotaWarning ¶
OverQuotaWarning indicates that the user is over their quota, and is being slowed down by the server.
func (OverQuotaWarning) Error ¶
func (w OverQuotaWarning) Error() string
Error implements the error interface for OverQuotaWarning.
type PaddedBlockReadError ¶
PaddedBlockReadError occurs if the number of bytes read do not equal the number of bytes specified.
func (PaddedBlockReadError) Error ¶
func (e PaddedBlockReadError) Error() string
Error implements the error interface of PaddedBlockReadError.
type ParentNodeNotFoundError ¶
type ParentNodeNotFoundError struct {
// contains filtered or unexported fields
}
ParentNodeNotFoundError indicates that we tried to update a Node's parent with a BlockPointer that we don't yet know about.
func (ParentNodeNotFoundError) Error ¶
func (e ParentNodeNotFoundError) Error() string
Error implements the error interface for ParentNodeNotFoundError.
type PrivateMetadata ¶
type PrivateMetadata struct {
// directory entry for the root directory block
Dir DirEntry
// m_f as described in 4.1.1 of https://keybase.io/blog/kbfs-crypto.
TLFPrivateKey TLFPrivateKey
// The block changes done as part of the update that created this MD
Changes BlockChanges
codec.UnknownFieldSetHandler
// contains filtered or unexported fields
}
PrivateMetadata contains the portion of metadata that's secret for private directories
func (PrivateMetadata) ChangesBlockInfo ¶
func (p PrivateMetadata) ChangesBlockInfo() BlockInfo
ChangesBlockInfo returns the block info for any unembedded changes.
type RawDefaultHash ¶
RawDefaultHash is the type for the raw bytes of a default keybase hash. This is exposed for use as in-memory keys.
type ReadAccessError ¶
type ReadAccessError struct {
User libkb.NormalizedUsername
Tlf CanonicalTlfName
Public bool
}
ReadAccessError indicates that the user tried to read from a top-level folder without read permission.
func (ReadAccessError) Errno ¶
func (e ReadAccessError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for ReadAccessError.
func (ReadAccessError) Error ¶
func (e ReadAccessError) Error() string
Error implements the error interface for ReadAccessError
type ReadOnlyRootMetadata ¶
type ReadOnlyRootMetadata struct {
*RootMetadata
}
A ReadOnlyRootMetadata is a thin wrapper around a *RootMetadata. Functions that take a ReadOnlyRootMetadata parameter must not modify it, and therefore code that passes a ReadOnlyRootMetadata to a function can assume that it is not modified by that function. However, callers that convert a *RootMetadata to a ReadOnlyRootMetadata may still modify the underlying RootMetadata through the original pointer, so care must be taken if a function stores a ReadOnlyRootMetadata object past the end of the function, or when a function takes both a *RootMetadata and a ReadOnlyRootMetadata (see decryptMDPrivateData).
func (ReadOnlyRootMetadata) CheckValidSuccessor ¶
func (md ReadOnlyRootMetadata) CheckValidSuccessor( currID MdID, nextMd ReadOnlyRootMetadata) error
CheckValidSuccessor makes sure the given ReadOnlyRootMetadata is a valid successor to the current one, and returns an error otherwise.
type ReadyBlockData ¶
type ReadyBlockData struct {
// contains filtered or unexported fields
}
ReadyBlockData is a block that has been encoded (and encrypted).
func (ReadyBlockData) GetEncodedSize ¶
func (r ReadyBlockData) GetEncodedSize() int
GetEncodedSize returns the size of the encoded (and encrypted) block data.
type RekeyConflictError ¶
type RekeyConflictError struct {
Err error
}
RekeyConflictError indicates a conflict happened while trying to rekey.
func (RekeyConflictError) Error ¶
func (e RekeyConflictError) Error() string
Error implements the error interface for RekeyConflictError.
type RekeyIncompleteError ¶
type RekeyIncompleteError struct{}
RekeyIncompleteError is returned when a rekey is partially done but needs a writer to finish it.
func (RekeyIncompleteError) Error ¶
func (e RekeyIncompleteError) Error() string
type RekeyPermissionError ¶
type RekeyPermissionError struct {
User libkb.NormalizedUsername
Dir string
}
RekeyPermissionError indicates that the user tried to rekey a top-level folder in a manner inconsistent with their permissions.
func (RekeyPermissionError) Error ¶
func (e RekeyPermissionError) Error() string
Error implements the error interface for RekeyPermissionError
type RekeyQueue ¶
type RekeyQueue interface {
// Enqueue enqueues a folder for rekey action.
Enqueue(TlfID) <-chan error
// IsRekeyPending returns true if the given folder is in the rekey queue.
IsRekeyPending(TlfID) bool
// GetRekeyChannel will return any rekey completion channel (if pending.)
GetRekeyChannel(id TlfID) <-chan error
// Clear cancels all pending rekey actions and clears the queue.
Clear()
// Waits for all queued rekeys to finish
Wait(ctx context.Context) error
}
RekeyQueue is a managed queue of folders needing some rekey action taken upon them by the current client.
type RekeyQueueStandard ¶
type RekeyQueueStandard struct {
// contains filtered or unexported fields
}
RekeyQueueStandard implements the RekeyQueue interface.
func NewRekeyQueueStandard ¶
func NewRekeyQueueStandard(config Config) *RekeyQueueStandard
NewRekeyQueueStandard instantiates a new rekey worker.
func (*RekeyQueueStandard) Clear ¶
func (rkq *RekeyQueueStandard) Clear()
Clear implements the RekeyQueue interface for RekeyQueueStandard.
func (*RekeyQueueStandard) Enqueue ¶
func (rkq *RekeyQueueStandard) Enqueue(id TlfID) <-chan error
Enqueue implements the RekeyQueue interface for RekeyQueueStandard.
func (*RekeyQueueStandard) GetRekeyChannel ¶
func (rkq *RekeyQueueStandard) GetRekeyChannel(id TlfID) <-chan error
GetRekeyChannel implements the RekeyQueue interface for RekeyQueueStandard.
func (*RekeyQueueStandard) IsRekeyPending ¶
func (rkq *RekeyQueueStandard) IsRekeyPending(id TlfID) bool
IsRekeyPending implements the RekeyQueue interface for RekeyQueueStandard.
type RenameAcrossDirsError ¶
type RenameAcrossDirsError struct {
}
RenameAcrossDirsError indicates that the user tried to do an atomic rename across directories.
func (RenameAcrossDirsError) Error ¶
func (e RenameAcrossDirsError) Error() string
Error implements the error interface for RenameAcrossDirsError
type RepeatedWaitGroup ¶
type RepeatedWaitGroup struct {
// contains filtered or unexported fields
}
RepeatedWaitGroup can be used in place of a sync.WaitGroup when code may need to repeatedly wait for a set of tasks to finish. (sync.WaitGroup requires special mutex usage to make this work properly, which can easily lead to deadlocks.) We use a mutex, int, and channel to track and synchronize on the number of outstanding tasks.
func (*RepeatedWaitGroup) Add ¶
func (rwg *RepeatedWaitGroup) Add(delta int)
Add indicates that a number of tasks have begun.
func (*RepeatedWaitGroup) Done ¶
func (rwg *RepeatedWaitGroup) Done()
Done indicates that one task has completed.
type ReportedError ¶
ReportedError represents an error reported by KBFS.
type Reporter ¶
type Reporter interface {
// ReportErr records that a given error happened.
ReportErr(ctx context.Context, tlfName CanonicalTlfName, public bool,
mode ErrorModeType, err error)
// AllKnownErrors returns all errors known to this Reporter.
AllKnownErrors() []ReportedError
// Notify sends the given notification to any sink.
Notify(ctx context.Context, notification *keybase1.FSNotification)
// Shutdown frees any resources allocated by a Reporter.
Shutdown()
}
Reporter exports events (asynchronously) to any number of sinks
type ReporterKBPKI ¶
type ReporterKBPKI struct {
*ReporterSimple
// contains filtered or unexported fields
}
ReporterKBPKI implements the Notify function of the Reporter interface in addition to embedding ReporterSimple for error tracking. Notify will make RPCs to the keybase daemon.
func NewReporterKBPKI ¶
func NewReporterKBPKI(config Config, maxErrors, bufSize int) *ReporterKBPKI
NewReporterKBPKI creates a new ReporterKBPKI.
func (*ReporterKBPKI) Notify ¶
func (r *ReporterKBPKI) Notify(ctx context.Context, notification *keybase1.FSNotification)
Notify implements the Reporter interface for ReporterKBPKI.
TODO: might be useful to get the debug tags out of ctx and store
them in the notifyBuffer as well so that send() can put them back in its context.
func (*ReporterKBPKI) ReportErr ¶
func (r *ReporterKBPKI) ReportErr(ctx context.Context, tlfName CanonicalTlfName, public bool, mode ErrorModeType, err error)
ReportErr implements the Reporter interface for ReporterKBPKI.
func (*ReporterKBPKI) Shutdown ¶
func (r *ReporterKBPKI) Shutdown()
Shutdown implements the Reporter interface for ReporterKBPKI.
type ReporterSimple ¶
type ReporterSimple struct {
// contains filtered or unexported fields
}
ReporterSimple remembers the last maxErrors errors, or all errors if maxErrors < 1.
func NewReporterSimple ¶
func NewReporterSimple(clock Clock, maxErrors int) *ReporterSimple
NewReporterSimple creates a new ReporterSimple.
func (*ReporterSimple) AllKnownErrors ¶
func (r *ReporterSimple) AllKnownErrors() []ReportedError
AllKnownErrors implements the Reporter interface for ReporterSimple.
func (*ReporterSimple) Notify ¶
func (r *ReporterSimple) Notify(_ context.Context, _ *keybase1.FSNotification)
Notify implements the Reporter interface for ReporterSimple.
func (*ReporterSimple) ReportErr ¶
func (r *ReporterSimple) ReportErr(ctx context.Context, _ CanonicalTlfName, _ bool, _ ErrorModeType, err error)
ReportErr implements the Reporter interface for ReporterSimple.
func (*ReporterSimple) Shutdown ¶
func (r *ReporterSimple) Shutdown()
Shutdown implements the Reporter interface for ReporterSimple.
type RootMetadata ¶
type RootMetadata struct {
// contains filtered or unexported fields
}
A RootMetadata is a BareRootMetadata but with a deserialized PrivateMetadata. However, note that it is possible that the PrivateMetadata has to be left serialized due to not having the right keys.
func NewRootMetadata ¶
func NewRootMetadata() *RootMetadata
NewRootMetadata returns a new RootMetadata object at the latest known version.
func (*RootMetadata) AddDiskUsage ¶
func (md *RootMetadata) AddDiskUsage(diskUsage uint64)
AddDiskUsage wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) AddNewKeys ¶
func (md *RootMetadata) AddNewKeys( wkb TLFWriterKeyBundle, rkb TLFReaderKeyBundle) error
AddNewKeys makes a new key generation for this RootMetadata using the given TLF key bundles.
func (*RootMetadata) AddOp ¶
func (md *RootMetadata) AddOp(o op)
AddOp starts a new operation for this MD update. Subsequent AddRefBlock, AddUnrefBlock, and AddUpdate calls will be applied to this operation.
func (*RootMetadata) AddRefBlock ¶
func (md *RootMetadata) AddRefBlock(info BlockInfo)
AddRefBlock adds the newly-referenced block to the add block change list.
func (*RootMetadata) AddRefBytes ¶
func (md *RootMetadata) AddRefBytes(refBytes uint64)
AddRefBytes wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) AddUnrefBlock ¶
func (md *RootMetadata) AddUnrefBlock(info BlockInfo)
AddUnrefBlock adds the newly-unreferenced block to the add block change list.
func (*RootMetadata) AddUnrefBytes ¶
func (md *RootMetadata) AddUnrefBytes(unrefBytes uint64)
AddUnrefBytes wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) AddUpdate ¶
func (md *RootMetadata) AddUpdate(oldInfo BlockInfo, newInfo BlockInfo)
AddUpdate adds the newly-updated block to the add block change list.
func (*RootMetadata) BID ¶
func (md *RootMetadata) BID() BranchID
BID wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) ClearBlockChanges ¶
func (md *RootMetadata) ClearBlockChanges()
ClearBlockChanges resets the block change lists to empty for this RootMetadata.
func (*RootMetadata) Data ¶
func (md *RootMetadata) Data() *PrivateMetadata
Data returns the private metadata of this RootMetadata.
func (*RootMetadata) DiskUsage ¶
func (md *RootMetadata) DiskUsage() uint64
DiskUsage wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) FakeInitialRekey ¶
func (md *RootMetadata) FakeInitialRekey(h BareTlfHandle)
FakeInitialRekey wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) GetBareRootMetadata ¶
func (md *RootMetadata) GetBareRootMetadata() BareRootMetadata
GetBareRootMetadata returns an interface to the underlying serializeable metadata.
func (*RootMetadata) GetSerializedPrivateMetadata ¶
func (md *RootMetadata) GetSerializedPrivateMetadata() []byte
GetSerializedPrivateMetadata wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) GetSerializedWriterMetadata ¶
func (md *RootMetadata) GetSerializedWriterMetadata(codec Codec) ([]byte, error)
GetSerializedWriterMetadata wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) GetTLFCryptKeyParams ¶
func (md *RootMetadata) GetTLFCryptKeyParams( keyGen KeyGen, user keybase1.UID, key CryptPublicKey) ( TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, TLFCryptKeyServerHalfID, bool, error)
GetTLFCryptKeyParams wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) GetTlfHandle ¶
func (md *RootMetadata) GetTlfHandle() *TlfHandle
GetTlfHandle returns the TlfHandle for this RootMetadata.
func (*RootMetadata) GetWriterMetadataSigInfo ¶
func (md *RootMetadata) GetWriterMetadataSigInfo() SignatureInfo
GetWriterMetadataSigInfo wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) HasKeyForUser ¶
func (md *RootMetadata) HasKeyForUser(keyGen KeyGen, user keybase1.UID) bool
HasKeyForUser wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) IsFinal ¶
func (md *RootMetadata) IsFinal() bool
IsFinal wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) IsInitialized ¶
func (md *RootMetadata) IsInitialized() bool
IsInitialized returns whether or not this RootMetadata has been initialized
func (*RootMetadata) IsReadable ¶
func (md *RootMetadata) IsReadable() bool
IsReadable returns true if the private metadata can be read.
func (*RootMetadata) IsRekeySet ¶
func (md *RootMetadata) IsRekeySet() bool
IsRekeySet wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) IsUnmergedSet ¶
func (md *RootMetadata) IsUnmergedSet() bool
IsUnmergedSet wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) IsWriterMetadataCopiedSet ¶
func (md *RootMetadata) IsWriterMetadataCopiedSet() bool
IsWriterMetadataCopiedSet wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) LastModifyingUser ¶
func (md *RootMetadata) LastModifyingUser() keybase1.UID
LastModifyingUser wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) LastModifyingWriter ¶
func (md *RootMetadata) LastModifyingWriter() keybase1.UID
LastModifyingWriter wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) LastModifyingWriterKID ¶
func (md *RootMetadata) LastModifyingWriterKID() keybase1.KID
LastModifyingWriterKID wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) LatestKeyGeneration ¶
func (md *RootMetadata) LatestKeyGeneration() KeyGen
LatestKeyGeneration wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) MakeBareTlfHandle ¶
func (md *RootMetadata) MakeBareTlfHandle() (BareTlfHandle, error)
MakeBareTlfHandle makes a BareTlfHandle for this RootMetadata. Should be used only by servers and MDOps.
func (*RootMetadata) MakeSuccessor ¶
func (md *RootMetadata) MakeSuccessor( config Config, mdID MdID, isWriter bool) (*RootMetadata, error)
MakeSuccessor returns a complete copy of this RootMetadata (but with cleared block change lists and cleared serialized metadata), with the revision incremented and a correct backpointer.
func (*RootMetadata) MergedStatus ¶
func (md *RootMetadata) MergedStatus() MergeStatus
MergedStatus wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) PrevRoot ¶
func (md *RootMetadata) PrevRoot() MdID
PrevRoot wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) ReadOnly ¶
func (md *RootMetadata) ReadOnly() ReadOnlyRootMetadata
ReadOnly makes a ReadOnlyRootMetadata from the current *RootMetadata.
func (*RootMetadata) RefBytes ¶
func (md *RootMetadata) RefBytes() uint64
RefBytes wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) Revision ¶
func (md *RootMetadata) Revision() MetadataRevision
Revision wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetBranchID ¶
func (md *RootMetadata) SetBranchID(bid BranchID)
SetBranchID wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetConflictInfo ¶
func (md *RootMetadata) SetConflictInfo(ci *TlfHandleExtension)
SetConflictInfo wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetDiskUsage ¶
func (md *RootMetadata) SetDiskUsage(diskUsage uint64)
SetDiskUsage wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetFinalBit ¶
func (md *RootMetadata) SetFinalBit()
SetFinalBit wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetFinalizedInfo ¶
func (md *RootMetadata) SetFinalizedInfo(fi *TlfHandleExtension)
SetFinalizedInfo wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetLastModifyingUser ¶
func (md *RootMetadata) SetLastModifyingUser(user keybase1.UID)
SetLastModifyingUser wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetLastModifyingWriter ¶
func (md *RootMetadata) SetLastModifyingWriter(user keybase1.UID)
SetLastModifyingWriter wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetPrevRoot ¶
func (md *RootMetadata) SetPrevRoot(mdID MdID)
SetPrevRoot wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetRefBytes ¶
func (md *RootMetadata) SetRefBytes(refBytes uint64)
SetRefBytes wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetRekeyBit ¶
func (md *RootMetadata) SetRekeyBit()
SetRekeyBit wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetRevision ¶
func (md *RootMetadata) SetRevision(revision MetadataRevision)
SetRevision wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetSerializedPrivateMetadata ¶
func (md *RootMetadata) SetSerializedPrivateMetadata(spmd []byte)
SetSerializedPrivateMetadata wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetTlfID ¶
func (md *RootMetadata) SetTlfID(tlf TlfID)
SetTlfID wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetUnmerged ¶
func (md *RootMetadata) SetUnmerged()
SetUnmerged wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetUnrefBytes ¶
func (md *RootMetadata) SetUnrefBytes(unrefBytes uint64)
SetUnrefBytes wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetUnresolvedReaders ¶
func (md *RootMetadata) SetUnresolvedReaders(readers []keybase1.SocialAssertion)
SetUnresolvedReaders wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetUnresolvedWriters ¶
func (md *RootMetadata) SetUnresolvedWriters(writers []keybase1.SocialAssertion)
SetUnresolvedWriters wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetWriterMetadataCopiedBit ¶
func (md *RootMetadata) SetWriterMetadataCopiedBit()
SetWriterMetadataCopiedBit wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetWriterMetadataSigInfo ¶
func (md *RootMetadata) SetWriterMetadataSigInfo(sigInfo SignatureInfo)
SetWriterMetadataSigInfo wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetWriters ¶
func (md *RootMetadata) SetWriters(writers []keybase1.UID)
SetWriters wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) TlfID ¶
func (md *RootMetadata) TlfID() TlfID
TlfID wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) UnrefBytes ¶
func (md *RootMetadata) UnrefBytes() uint64
UnrefBytes wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) Update ¶
func (md *RootMetadata) Update(id TlfID, h BareTlfHandle) error
Update wraps the respective method of the underlying BareRootMetadata for convenience.
type RootMetadataSigned ¶
type RootMetadataSigned struct {
// signature over the root metadata by the private signing key
SigInfo SignatureInfo `codec:",omitempty"`
// all the metadata
MD MutableBareRootMetadata
// contains filtered or unexported fields
}
RootMetadataSigned is the top-level MD object stored in MD server
func DecodeRootMetadataSigned ¶
func DecodeRootMetadataSigned(codec Codec, tlf TlfID, ver, max MetadataVer, buf []byte) ( *RootMetadataSigned, error)
DecodeRootMetadataSigned deserializes a metaddata block into the specified versioned structure.
func NewRootMetadataSigned ¶
func NewRootMetadataSigned() *RootMetadataSigned
NewRootMetadataSigned returns a new RootMetadataSigned object at the latest known version.
func NewRootMetadataSignedForTest ¶
func NewRootMetadataSignedForTest(id TlfID, h BareTlfHandle) (*RootMetadataSigned, error)
NewRootMetadataSignedForTest returns a new RootMetadataSigned for testing.
func (*RootMetadataSigned) IsLastModifiedBy ¶
func (rmds *RootMetadataSigned) IsLastModifiedBy( uid keybase1.UID, key VerifyingKey) error
IsLastModifiedBy verifies that the RootMetadataSigned is written by the given user and device (identified by the KID of the device verifying key), and returns an error if not.
func (*RootMetadataSigned) IsValidAndSigned ¶
func (rmds *RootMetadataSigned) IsValidAndSigned( codec Codec, crypto cryptoPure) error
IsValidAndSigned verifies the RootMetadataSigned, checks the root signature, and returns an error if a problem was found. This should be the first thing checked on an RMDS retrieved from an untrusted source, and then the signing users and keys should be validated, either by comparing to the current device key (using IsLastModifiedBy), or by checking with KBPKI.
func (*RootMetadataSigned) MakeFinalCopy ¶
func (rmds *RootMetadataSigned) MakeFinalCopy(config Config) ( *RootMetadataSigned, error)
MakeFinalCopy returns a complete copy of this RootMetadataSigned with the revision incremented and the final bit set.
func (*RootMetadataSigned) MerkleHash ¶
func (rmds *RootMetadataSigned) MerkleHash(config Config) (MerkleHash, error)
MerkleHash computes a hash of this RootMetadataSigned object for inclusion into the KBFS Merkle tree.
func (*RootMetadataSigned) Version ¶
func (rmds *RootMetadataSigned) Version() MetadataVer
Version returns the metadata version of this MD block, depending on which features it uses.
type SessionInfo ¶
type SessionInfo struct {
Name libkb.NormalizedUsername
UID keybase1.UID
Token string
CryptPublicKey CryptPublicKey
VerifyingKey VerifyingKey
}
SessionInfo contains all the info about the keybase session that kbfs cares about.
func SessionInfoFromProtocol ¶
func SessionInfoFromProtocol(session keybase1.Session) (SessionInfo, error)
SessionInfoFromProtocol returns SessionInfo from Session
type SharedKeybaseTransport ¶
type SharedKeybaseTransport struct {
// contains filtered or unexported fields
}
SharedKeybaseTransport is a ConnectionTransport implementation that uses a shared local socket to a keybase daemon.
func (*SharedKeybaseTransport) Close ¶
func (kt *SharedKeybaseTransport) Close()
Close is an implementation of the ConnectionTransport interface.
func (*SharedKeybaseTransport) Dial ¶
func (kt *SharedKeybaseTransport) Dial(ctx context.Context) ( rpc.Transporter, error)
Dial is an implementation of the ConnectionTransport interface.
func (*SharedKeybaseTransport) Finalize ¶
func (kt *SharedKeybaseTransport) Finalize()
Finalize is an implementation of the ConnectionTransport interface.
func (*SharedKeybaseTransport) IsConnected ¶
func (kt *SharedKeybaseTransport) IsConnected() bool
IsConnected is an implementation of the ConnectionTransport interface.
type ShutdownHappenedError ¶
type ShutdownHappenedError struct {
}
ShutdownHappenedError indicates that shutdown has happened.
func (ShutdownHappenedError) Error ¶
func (e ShutdownHappenedError) Error() string
Error implements the error interface for ShutdownHappenedError.
type SigVer ¶
type SigVer int
SigVer denotes a signature version.
const ( // SigED25519 is the signature type for ED25519 SigED25519 SigVer = 1 )
type SignatureInfo ¶
type SignatureInfo struct {
// Exported only for serialization purposes.
Version SigVer `codec:"v"`
Signature []byte `codec:"s"`
VerifyingKey VerifyingKey `codec:"k"`
}
SignatureInfo contains all the info needed to verify a signature for a message.
func (SignatureInfo) IsNil ¶
func (s SignatureInfo) IsNil() bool
IsNil returns true if this SignatureInfo is nil.
func (SignatureInfo) String ¶
func (s SignatureInfo) String() string
String implements the fmt.Stringer interface for SignatureInfo.
type SigningKey ¶
type SigningKey struct {
// contains filtered or unexported fields
}
SigningKey is a key pair for signing.
func MakeFakeSigningKeyOrBust ¶
func MakeFakeSigningKeyOrBust(seed string) SigningKey
MakeFakeSigningKeyOrBust makes a new signing key from fake randomness made from the given seed.
func MakeLocalUserSigningKeyOrBust ¶
func MakeLocalUserSigningKeyOrBust(name libkb.NormalizedUsername) SigningKey
MakeLocalUserSigningKeyOrBust returns a unique signing key for this user.
func NewSigningKey ¶
func NewSigningKey(kp libkb.NaclSigningKeyPair) SigningKey
NewSigningKey returns a SigningKey using the given key pair.
func (SigningKey) GetVerifyingKey ¶
func (k SigningKey) GetVerifyingKey() VerifyingKey
GetVerifyingKey returns the public key half of this signing key.
type SigningKeySecret ¶
type SigningKeySecret struct {
// contains filtered or unexported fields
}
SigningKeySecret is a secret that can be used to construct a SigningKey.
type SizeFlag ¶
type SizeFlag struct {
// contains filtered or unexported fields
}
SizeFlag is for specifying sizes with the flag package.
type StallableBlockOp ¶
type StallableBlockOp stallableOp
StallableBlockOp defines an Op that is stallable using StallBlockOp
type StallableMDOp ¶
type StallableMDOp stallableOp
StallableMDOp defines an Op that is stallable using StallMDOp
type StateChecker ¶
type StateChecker struct {
// contains filtered or unexported fields
}
StateChecker verifies that the server-side state for KBFS is consistent. Useful mostly for testing because it isn't scalable and loads all the state in memory.
func NewStateChecker ¶
func NewStateChecker(config Config) *StateChecker
NewStateChecker returns a new StateChecker instance.
func (*StateChecker) CheckMergedState ¶
func (sc *StateChecker) CheckMergedState(ctx context.Context, tlf TlfID) error
CheckMergedState verifies that the state for the given tlf is consistent.
type StatusUpdate ¶
type StatusUpdate struct{}
StatusUpdate is a dummy type used to indicate status has been updated.
type TLFCryptKey ¶
type TLFCryptKey struct {
// contains filtered or unexported fields
}
TLFCryptKey (s^{f,0}) is used to encrypt/decrypt the private portion of TLF metadata. It is also used to mask BlockCryptKeys. (See 4.1.1, 4.1.2.)
Copies of TLFCryptKey objects are deep copies.
func MakeTLFCryptKey ¶
func MakeTLFCryptKey(data [32]byte) TLFCryptKey
MakeTLFCryptKey returns a TLFCryptKey containing the given data.
func (TLFCryptKey) MarshalBinary ¶
func (*TLFCryptKey) UnmarshalBinary ¶
type TLFCryptKeyClientHalf ¶
type TLFCryptKeyClientHalf struct {
// contains filtered or unexported fields
}
TLFCryptKeyClientHalf (t_u^{f,0,i}) is the masked, client-side half of a TLFCryptKey, which can be recovered only with both halves. (See 4.1.1.)
Copies of TLFCryptKeyClientHalf objects are deep copies.
func MakeTLFCryptKeyClientHalf ¶
func MakeTLFCryptKeyClientHalf(data [32]byte) TLFCryptKeyClientHalf
MakeTLFCryptKeyClientHalf returns a TLFCryptKeyClientHalf containing the given data.
func (TLFCryptKeyClientHalf) MarshalBinary ¶
func (*TLFCryptKeyClientHalf) UnmarshalBinary ¶
type TLFCryptKeyInfo ¶
type TLFCryptKeyInfo struct {
ClientHalf EncryptedTLFCryptKeyClientHalf
ServerHalfID TLFCryptKeyServerHalfID
EPubKeyIndex int `codec:"i,omitempty"`
codec.UnknownFieldSetHandler
}
TLFCryptKeyInfo is a per-device key half entry in the TLFWriterKeyBundle/TLFReaderKeyBundle.
type TLFCryptKeyServerHalf ¶
type TLFCryptKeyServerHalf struct {
// contains filtered or unexported fields
}
TLFCryptKeyServerHalf (s_u^{f,0,i}) is the masked, server-side half of a TLFCryptKey, which can be recovered only with both halves. (See 4.1.1.)
Copies of TLFCryptKeyServerHalf objects are deep copies.
func MakeTLFCryptKeyServerHalf ¶
func MakeTLFCryptKeyServerHalf(data [32]byte) TLFCryptKeyServerHalf
MakeTLFCryptKeyServerHalf returns a TLFCryptKeyServerHalf containing the given data.
func (TLFCryptKeyServerHalf) MarshalBinary ¶
func (*TLFCryptKeyServerHalf) UnmarshalBinary ¶
type TLFCryptKeyServerHalfID ¶
type TLFCryptKeyServerHalfID struct {
ID HMAC // Exported for serialization.
}
TLFCryptKeyServerHalfID is the identifier type for a server-side key half.
func (TLFCryptKeyServerHalfID) String ¶
func (id TLFCryptKeyServerHalfID) String() string
String implements the Stringer interface for TLFCryptKeyServerHalfID.
type TLFEphemeralPrivateKey ¶
type TLFEphemeralPrivateKey struct {
// contains filtered or unexported fields
}
TLFEphemeralPrivateKey (m_e) is used (with a CryptPublicKey) to encrypt TLFCryptKeyClientHalf objects (t_u^{f,0,i}) for non-public directories. (See 4.1.1.)
Copies of TLFEphemeralPrivateKey objects are deep copies.
func MakeTLFEphemeralPrivateKey ¶
func MakeTLFEphemeralPrivateKey(data [32]byte) TLFEphemeralPrivateKey
MakeTLFEphemeralPrivateKey returns a TLFEphemeralPrivateKey containing the given data.
func (TLFEphemeralPrivateKey) MarshalBinary ¶
func (*TLFEphemeralPrivateKey) UnmarshalBinary ¶
type TLFEphemeralPublicKey ¶
type TLFEphemeralPublicKey struct {
// contains filtered or unexported fields
}
TLFEphemeralPublicKey (M_e) is used along with a crypt private key to decrypt TLFCryptKeyClientHalf objects (t_u^{f,0,i}) for non-public directories. (See 4.1.1.)
Copies of TLFEphemeralPublicKey objects are deep copies.
func MakeTLFEphemeralPublicKey ¶
func MakeTLFEphemeralPublicKey(data [32]byte) TLFEphemeralPublicKey
MakeTLFEphemeralPublicKey returns a TLFEphemeralPublicKey containing the given data.
func (TLFEphemeralPublicKey) MarshalBinary ¶
func (*TLFEphemeralPublicKey) UnmarshalBinary ¶
type TLFEphemeralPublicKeys ¶
type TLFEphemeralPublicKeys []TLFEphemeralPublicKey
TLFEphemeralPublicKeys stores a list of TLFEphemeralPublicKey
type TLFJournalStatus ¶
type TLFJournalStatus struct {
RevisionStart MetadataRevision
RevisionEnd MetadataRevision
BlockOpCount uint64
}
TLFJournalStatus represents the status of a TLF's journal for display in diagnostics. It is suitable for encoding directly as JSON.
type TLFPrivateKey ¶
type TLFPrivateKey struct {
// contains filtered or unexported fields
}
A TLFPrivateKey (m_f) is the private half of the permanent keypair associated with a TLF. (See 4.1.1, 5.3.)
Copies of TLFPrivateKey objects are deep copies.
func MakeTLFPrivateKey ¶
func MakeTLFPrivateKey(data [32]byte) TLFPrivateKey
MakeTLFPrivateKey returns a TLFPrivateKey containing the given data.
func (TLFPrivateKey) MarshalBinary ¶
func (*TLFPrivateKey) UnmarshalBinary ¶
type TLFPublicKey ¶
type TLFPublicKey struct {
// contains filtered or unexported fields
}
A TLFPublicKey (M_f) is the public half of the permanent keypair associated with a TLF. It is included in the site-wide private-data Merkle tree. (See 4.1.1, 5.3.)
Copies of TLFPublicKey objects are deep copies.
func MakeTLFPublicKey ¶
func MakeTLFPublicKey(data [32]byte) TLFPublicKey
MakeTLFPublicKey returns a TLFPublicKey containing the given data.
func (TLFPublicKey) MarshalBinary ¶
func (*TLFPublicKey) UnmarshalBinary ¶
type TLFReaderKeyBundle ¶
type TLFReaderKeyBundle struct {
RKeys UserDeviceKeyInfoMap
// M_e as described in 4.1.1 of https://keybase.io/blog/kbfs-crypto.
// Because devices can be added into the key generation after it
// is initially created (so those devices can get access to
// existing data), we track multiple ephemeral public keys; the
// one used by a particular device is specified by EPubKeyIndex in
// its TLFCryptoKeyInfo struct.
// This list is needed so a reader rekey doesn't modify the writer
// metadata.
TLFReaderEphemeralPublicKeys TLFEphemeralPublicKeys `codec:"readerEPubKey,omitempty"`
codec.UnknownFieldSetHandler
}
TLFReaderKeyBundle stores all the user keys with reader permissions on a TLF
func NewEmptyTLFReaderKeyBundle ¶
func NewEmptyTLFReaderKeyBundle() TLFReaderKeyBundle
NewEmptyTLFReaderKeyBundle creates a new empty TLFReaderKeyBundle
type TLFReaderKeyGenerations ¶
type TLFReaderKeyGenerations []TLFReaderKeyBundle
TLFReaderKeyGenerations stores a slice of TLFReaderKeyBundle, where the last element is the current generation.
func (TLFReaderKeyGenerations) IsReader ¶
IsReader returns whether or not the user+device is an authorized reader for the latest generation.
func (TLFReaderKeyGenerations) LatestKeyGeneration ¶
func (tkg TLFReaderKeyGenerations) LatestKeyGeneration() KeyGen
LatestKeyGeneration returns the current key generation for this TLF.
type TLFUpdateHistory ¶
type TLFUpdateHistory struct {
ID string
Name string
Updates []UpdateSummary
}
TLFUpdateHistory gives all the summaries of all updates in a TLF's history.
type TLFWriterKeyBundle ¶
type TLFWriterKeyBundle struct {
// Maps from each writer to their crypt key bundle.
WKeys UserDeviceKeyInfoMap
// M_f as described in 4.1.1 of https://keybase.io/blog/kbfs-crypto.
TLFPublicKey TLFPublicKey `codec:"pubKey"`
// M_e as described in 4.1.1 of https://keybase.io/blog/kbfs-crypto.
// Because devices can be added into the key generation after it
// is initially created (so those devices can get access to
// existing data), we track multiple ephemeral public keys; the
// one used by a particular device is specified by EPubKeyIndex in
// its TLFCryptoKeyInfo struct.
TLFEphemeralPublicKeys TLFEphemeralPublicKeys `codec:"ePubKey"`
codec.UnknownFieldSetHandler
}
TLFWriterKeyBundle is a bundle of all the writer keys for a top-level folder.
func NewEmptyTLFWriterKeyBundle ¶
func NewEmptyTLFWriterKeyBundle() TLFWriterKeyBundle
NewEmptyTLFWriterKeyBundle creates a new empty TLFWriterKeyBundle
type TLFWriterKeyGenerations ¶
type TLFWriterKeyGenerations []TLFWriterKeyBundle
TLFWriterKeyGenerations stores a slice of TLFWriterKeyBundle, where the last element is the current generation.
func (TLFWriterKeyGenerations) IsWriter ¶
IsWriter returns whether or not the user+device is an authorized writer for the latest generation.
func (TLFWriterKeyGenerations) LatestKeyGeneration ¶
func (tkg TLFWriterKeyGenerations) LatestKeyGeneration() KeyGen
LatestKeyGeneration returns the current key generation for this TLF.
type TestClock ¶
type TestClock struct {
// contains filtered or unexported fields
}
TestClock returns a set time as the current time.
type TestDynamoDBRunner ¶
type TestDynamoDBRunner struct {
// contains filtered or unexported fields
}
TestDynamoDBRunner manages starting/stopping a local dynamodb test server.
func NewTestDynamoDBRunner ¶
func NewTestDynamoDBRunner() (*TestDynamoDBRunner, error)
NewTestDynamoDBRunner instatiates a new runner.
func (*TestDynamoDBRunner) Run ¶
func (tdr *TestDynamoDBRunner) Run(t logger.TestLogBackend)
Run starts the local DynamoDB server.
func (*TestDynamoDBRunner) Shutdown ¶
func (tdr *TestDynamoDBRunner) Shutdown(t logger.TestLogBackend)
Shutdown terminates any running instance.
type TimeoutError ¶
type TimeoutError struct {
}
TimeoutError is just a replacement for context.DeadlineExceeded with a more friendly error string.
func (TimeoutError) Error ¶
func (e TimeoutError) Error() string
type TlfAccessError ¶
type TlfAccessError struct {
ID TlfID
}
TlfAccessError that the user tried to perform an unpermitted operation on a top-level folder.
func (TlfAccessError) Error ¶
func (e TlfAccessError) Error() string
Error implements the error interface for TlfAccessError
type TlfEdit ¶
type TlfEdit struct {
Filepath string // relative to the TLF root
Type TlfEditNotificationType
LocalTime time.Time // reflects difference between server and local clock
// contains filtered or unexported fields
}
TlfEdit represents an individual update about a file edit within a TLF.
type TlfEditHistory ¶
type TlfEditHistory struct {
// contains filtered or unexported fields
}
TlfEditHistory allows you to get the update history about a particular TLF.
func NewTlfEditHistory ¶
func NewTlfEditHistory(config Config, fbo *folderBranchOps, log logger.Logger) *TlfEditHistory
NewTlfEditHistory makes a new TLF edit history.
func (*TlfEditHistory) GetComplete ¶
func (teh *TlfEditHistory) GetComplete(ctx context.Context, head ImmutableRootMetadata) (TlfWriterEdits, error)
GetComplete returns the most recently known set of clustered edit history for this TLF.
func (*TlfEditHistory) Shutdown ¶
func (teh *TlfEditHistory) Shutdown()
Shutdown shuts down all background processing.
func (*TlfEditHistory) UpdateHistory ¶
func (teh *TlfEditHistory) UpdateHistory(ctx context.Context, rmds []ImmutableRootMetadata) error
UpdateHistory updates the cached edit history, and sends FS notifications about the changes. This assumes the last ImmutableRootMetadata in rmds is the current head.
type TlfEditList ¶
type TlfEditList []TlfEdit
TlfEditList is a list of edits by a particular user, that can be sort by increasing timestamp.
func (TlfEditList) Len ¶
func (tel TlfEditList) Len() int
Len implements sort.Interface for TlfEditList
func (TlfEditList) Less ¶
func (tel TlfEditList) Less(i, j int) bool
Less implements sort.Interface for TlfEditList
func (TlfEditList) Swap ¶
func (tel TlfEditList) Swap(i, j int)
Swap implements sort.Interface for TlfEditList
type TlfEditNotificationType ¶
type TlfEditNotificationType int
TlfEditNotificationType indicates what type of edit happened to a file.
const ( // FileCreated indicates a new file. FileCreated TlfEditNotificationType = iota // FileModified indicates an existing file that was written to. FileModified )
type TlfHandle ¶
type TlfHandle struct {
// contains filtered or unexported fields
}
TlfHandle contains all the info in a BareTlfHandle as well as additional info. This doesn't embed BareTlfHandle to avoid having to keep track of data in multiple places.
func MakeTlfHandle ¶
func MakeTlfHandle( ctx context.Context, bareHandle BareTlfHandle, nug normalizedUsernameGetter) (*TlfHandle, error)
MakeTlfHandle creates a TlfHandle from the given BareTlfHandle and the given normalizedUsernameGetter (which is usually a KBPKI).
func ParseTlfHandle ¶
func ParseTlfHandle( ctx context.Context, kbpki KBPKI, name string, public bool) ( *TlfHandle, error)
ParseTlfHandle parses a TlfHandle from an encoded string. See TlfHandle.GetCanonicalName() for the opposite direction.
Some errors that may be returned and can be specially handled:
TlfNameNotCanonical: Returned when the given name is not canonical -- another name to try (which itself may not be canonical) is in the error. Usually, you want to treat this as a symlink to the name to try.
NoSuchNameError: Returned when public is set and the given folder has no public folder.
func (TlfHandle) ConflictInfo ¶
func (h TlfHandle) ConflictInfo() *TlfHandleExtension
ConflictInfo returns the handle's conflict info, if any.
func (TlfHandle) EqualsIgnoreName ¶
EqualsIgnoreName returns whether h and other contain the same info ignoring the name.
func (TlfHandle) Extensions ¶
func (h TlfHandle) Extensions() (extensions []TlfHandleExtension)
Extensions returns a list of extensions for the given handle.
func (TlfHandle) FinalizedInfo ¶
func (h TlfHandle) FinalizedInfo() *TlfHandleExtension
FinalizedInfo returns the handle's finalized info, if any.
func (TlfHandle) FirstResolvedWriter ¶
FirstResolvedWriter returns the handle's first resolved writer UID (when sorted). This is used mostly for tests.
func (*TlfHandle) GetCanonicalName ¶
func (h *TlfHandle) GetCanonicalName() CanonicalTlfName
GetCanonicalName returns the canonical name of this TLF.
func (*TlfHandle) GetCanonicalPath ¶
GetCanonicalPath returns the full canonical path of this TLF.
func (TlfHandle) IsConflict ¶
IsConflict returns whether or not this TlfHandle represents a conflicted top-level folder.
func (TlfHandle) IsFinal ¶
IsFinal returns whether or not this TlfHandle represents a finalized top-level folder.
func (TlfHandle) IsPublic ¶
IsPublic returns whether or not this TlfHandle represents a public top-level folder.
func (TlfHandle) IsReader ¶
IsReader returns whether or not the given user is a reader for the top-level folder represented by this TlfHandle.
func (TlfHandle) IsWriter ¶
IsWriter returns whether or not the given user is a writer for the top-level folder represented by this TlfHandle.
func (*TlfHandle) ResolveAgain ¶
ResolveAgain tries to resolve any unresolved assertions in the given handle and returns a new handle with the results. As an optimization, if h contains no unresolved assertions, it just returns itself.
func (*TlfHandle) ResolveAgainForUser ¶
func (h *TlfHandle) ResolveAgainForUser(ctx context.Context, resolver resolver, uid keybase1.UID) (*TlfHandle, error)
ResolveAgainForUser tries to resolve any unresolved assertions in the given handle and returns a new handle with the results. As an optimization, if h contains no unresolved assertions, it just returns itself. If uid != keybase1.UID(""), it only allows assertions that resolve to uid.
func (TlfHandle) ResolvedReaders ¶
ResolvedReaders returns the handle's resolved reader UIDs in sorted order. If the handle is public, nil will be returned.
func (TlfHandle) ResolvedWriters ¶
ResolvedWriters returns the handle's resolved writer UIDs in sorted order.
func (TlfHandle) ResolvesTo ¶
func (h TlfHandle) ResolvesTo( ctx context.Context, codec Codec, resolver resolver, other TlfHandle) ( resolvesTo bool, partialResolvedH *TlfHandle, err error)
ResolvesTo returns whether this handle resolves to the given one. It also returns the partially-resolved version of h, i.e. h resolved except for unresolved assertions in other; this should equal other if and only if true is returned.
func (*TlfHandle) SetFinalizedInfo ¶
func (h *TlfHandle) SetFinalizedInfo(info *TlfHandleExtension)
SetFinalizedInfo sets the handle's finalized info to the given one, which may be nil.
func (TlfHandle) ToBareHandle ¶
func (h TlfHandle) ToBareHandle() (BareTlfHandle, error)
ToBareHandle returns a BareTlfHandle corresponding to this handle.
func (TlfHandle) ToBareHandleOrBust ¶
func (h TlfHandle) ToBareHandleOrBust() BareTlfHandle
ToBareHandleOrBust returns a BareTlfHandle corresponding to this handle, and panics if there's an error. Used by tests.
func (*TlfHandle) ToFavorite ¶
ToFavorite converts a TlfHandle into a Favorite, suitable for Favorites calls.
func (TlfHandle) UnresolvedReaders ¶
func (h TlfHandle) UnresolvedReaders() []keybase1.SocialAssertion
UnresolvedReaders returns the handle's unresolved readers in sorted order. If the handle is public, nil will be returned.
func (TlfHandle) UnresolvedWriters ¶
func (h TlfHandle) UnresolvedWriters() []keybase1.SocialAssertion
UnresolvedWriters returns the handle's unresolved writers in sorted order.
func (*TlfHandle) UpdateConflictInfo ¶
func (h *TlfHandle) UpdateConflictInfo( codec Codec, info *TlfHandleExtension) error
UpdateConflictInfo sets the handle's conflict info to the given one, if the existing one is nil. (In this case, the given one may also be nil.) Otherwise, the given conflict info must match the existing one.
type TlfHandleExtension ¶
type TlfHandleExtension struct {
Date int64 `codec:"date"`
Number uint16 `codec:"num"`
Type TlfHandleExtensionType `codec:"type"`
Username libkb.NormalizedUsername `codec:"un,omitempty"`
codec.UnknownFieldSetHandler
}
TlfHandleExtension is information which identifies a particular extension.
func NewTestTlfHandleExtensionStaticTime ¶
func NewTestTlfHandleExtensionStaticTime(extType TlfHandleExtensionType, num uint16, un libkb.NormalizedUsername) ( *TlfHandleExtension, error)
NewTestTlfHandleExtensionStaticTime returns a new TlfHandleExtension struct populated with a static date for testing.
func NewTestTlfHandleExtensionWithClock ¶
func NewTestTlfHandleExtensionWithClock(extType TlfHandleExtensionType, num uint16, un libkb.NormalizedUsername, clock Clock) (*TlfHandleExtension, error)
NewTestTlfHandleExtensionWithClock returns a new TlfHandleExtension using a passed clock.
func NewTlfHandleExtension ¶
func NewTlfHandleExtension(extType TlfHandleExtensionType, num uint16, un libkb.NormalizedUsername) ( *TlfHandleExtension, error)
NewTlfHandleExtension returns a new TlfHandleExtension struct populated with the current date and conflict number.
func ParseTlfHandleExtensionSuffix ¶
func ParseTlfHandleExtensionSuffix(s string) ([]TlfHandleExtension, error)
ParseTlfHandleExtensionSuffix parses a TLF handle extension suffix string.
func (TlfHandleExtension) String ¶
func (e TlfHandleExtension) String() string
String implements the fmt.Stringer interface for TlfHandleExtension. Ex: "(conflicted copy 2016-05-09 #2)"
type TlfHandleExtensionMismatchError ¶
type TlfHandleExtensionMismatchError struct {
Expected TlfHandleExtension
// Actual may be nil.
Actual *TlfHandleExtension
}
TlfHandleExtensionMismatchError indicates the expected extension doesn't match the server's extension for the given handle.
func (TlfHandleExtensionMismatchError) Error ¶
func (e TlfHandleExtensionMismatchError) Error() string
Error implements the error interface for TlfHandleExtensionMismatchError
type TlfHandleExtensionType ¶
type TlfHandleExtensionType int
TlfHandleExtensionType is the type of extension.
const ( // TlfHandleExtensionConflict means the handle conflicted as a result of a social // assertion resolution. TlfHandleExtensionConflict TlfHandleExtensionType = iota // TlfHandleExtensionFinalized means the folder ended up with no more valid writers as // a result of an account reset. TlfHandleExtensionFinalized // TlfHandleExtensionUnknown means the type is unknown. TlfHandleExtensionUnknown )
func ParseTlfHandleExtensionString ¶
func ParseTlfHandleExtensionString(s string) (TlfHandleExtensionType, libkb.NormalizedUsername)
ParseTlfHandleExtensionString parses an extension type and optional username from a string.
func (TlfHandleExtensionType) String ¶
func (et TlfHandleExtensionType) String(username libkb.NormalizedUsername) string
String implements the fmt.Stringer interface for TlfHandleExtensionType
type TlfHandleFinalizedError ¶
type TlfHandleFinalizedError struct {
}
TlfHandleFinalizedError is returned when something attempts to modify a finalized TLF handle.
func (TlfHandleFinalizedError) Error ¶
func (e TlfHandleFinalizedError) Error() string
Error implements the error interface for TlfHandleFinalizedError.
type TlfID ¶
type TlfID struct {
// contains filtered or unexported fields
}
TlfID is a top-level folder ID
func ParseTlfID ¶
ParseTlfID parses a hex encoded TlfID. Returns NullTlfID and an InvalidTlfID on failure.
func (TlfID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for TlfID.
func (*TlfID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for TlfID.
type TlfNameNotCanonical ¶
type TlfNameNotCanonical struct {
Name, NameToTry string
}
TlfNameNotCanonical indicates that a name isn't a canonical, and that another (not necessarily canonical) name should be tried.
func (TlfNameNotCanonical) Error ¶
func (e TlfNameNotCanonical) Error() string
type TlfWriterEdits ¶
type TlfWriterEdits map[keybase1.UID]TlfEditList
TlfWriterEdits is a map of a writer name to the most recent file edits in a given folder by that writer.
type TooLowByteCountError ¶
TooLowByteCountError indicates that size of a block is smaller than the expected size.
func (TooLowByteCountError) Error ¶
func (e TooLowByteCountError) Error() string
Error implements the error interface for TooLowByteCountError
type UnexpectedShortCryptoRandRead ¶
type UnexpectedShortCryptoRandRead struct {
}
UnexpectedShortCryptoRandRead indicates that fewer bytes were read from crypto.rand.Read() than expected.
func (UnexpectedShortCryptoRandRead) Error ¶
func (e UnexpectedShortCryptoRandRead) Error() string
Error implements the error interface for UnexpectedShortRandRead.
type UnexpectedUnmergedPutError ¶
type UnexpectedUnmergedPutError struct {
}
UnexpectedUnmergedPutError indicates that we tried to do an unmerged put when that was disallowed.
func (UnexpectedUnmergedPutError) Error ¶
func (e UnexpectedUnmergedPutError) Error() string
Error implements the error interface for UnexpectedUnmergedPutError
type UnknownEncryptionVer ¶
type UnknownEncryptionVer struct {
// contains filtered or unexported fields
}
UnknownEncryptionVer indicates that we can't decrypt an encryptedData object because it has an unknown version.
func (UnknownEncryptionVer) Error ¶
func (e UnknownEncryptionVer) Error() string
Error implements the error interface for UnknownEncryptionVer.
type UnknownHashTypeError ¶
type UnknownHashTypeError struct {
T HashType
}
UnknownHashTypeError is returned whenever a hash with an unknown hash type is attempted to be used for verification.
func (UnknownHashTypeError) Error ¶
func (e UnknownHashTypeError) Error() string
type UnknownSigVer ¶
type UnknownSigVer struct {
// contains filtered or unexported fields
}
UnknownSigVer indicates that we can't process a signature because it has an unknown version.
func (UnknownSigVer) Error ¶
func (e UnknownSigVer) Error() string
Error implements the error interface for UnknownSigVer
type UnmergedError ¶
type UnmergedError struct {
}
UnmergedError indicates that fbo is on an unmerged local revision
func (UnmergedError) Error ¶
func (e UnmergedError) Error() string
Error implements the error interface for UnmergedError.
type UnmergedSelfConflictError ¶
type UnmergedSelfConflictError struct {
Err error
}
UnmergedSelfConflictError indicates that we hit a conflict on the unmerged branch, so a previous MD PutUnmerged we thought had failed, had actually succeeded.
func (UnmergedSelfConflictError) Error ¶
func (e UnmergedSelfConflictError) Error() string
Error implements the error interface for UnmergedSelfConflictError.
type UnverifiableTlfUpdateError ¶
type UnverifiableTlfUpdateError struct {
Tlf string
User libkb.NormalizedUsername
Err error
}
UnverifiableTlfUpdateError indicates that a MD update could not be verified.
func (UnverifiableTlfUpdateError) Error ¶
func (e UnverifiableTlfUpdateError) Error() string
Error implements the error interface for UnverifiableTlfUpdateError.
type UpdateSummary ¶
type UpdateSummary struct {
Revision MetadataRevision
Date time.Time
Writer string
LiveBytes uint64 // the "DiskUsage" for the TLF as of this revision
Ops []OpSummary
}
UpdateSummary describes the operations done by a single MD revision.
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 UserDeviceKeyInfoMap ¶
type UserDeviceKeyInfoMap map[keybase1.UID]DeviceKeyInfoMap
UserDeviceKeyInfoMap maps a user's keybase UID to their DeviceKeyInfoMap
type UserInfo ¶
type UserInfo struct {
Name libkb.NormalizedUsername
UID keybase1.UID
VerifyingKeys []VerifyingKey
CryptPublicKeys []CryptPublicKey
KIDNames map[keybase1.KID]string
// Revoked keys, and the time at which they were revoked.
RevokedVerifyingKeys map[VerifyingKey]keybase1.KeybaseTime
RevokedCryptPublicKeys map[CryptPublicKey]keybase1.KeybaseTime
}
UserInfo contains all the info about a keybase user that kbfs cares about.
func UserInfoFromProtocol ¶
func UserInfoFromProtocol(upk keybase1.UserPlusKeys) (UserInfo, error)
UserInfoFromProtocol returns UserInfo from UserPlusKeys
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, config Config) (*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.
type VerifyingKey ¶
type VerifyingKey struct {
// contains filtered or unexported fields
}
A VerifyingKey is a public key that can be used to verify a signature created by the corresponding private signing key. In particular, VerifyingKeys are used to authenticate home and public TLFs. (See 4.2, 4.3.)
These are also sometimes known as sibkeys.
Copies of VerifyingKey objects are deep copies.
func MakeFakeVerifyingKeyOrBust ¶
func MakeFakeVerifyingKeyOrBust(seed string) VerifyingKey
MakeFakeVerifyingKeyOrBust makes a new key suitable for verifying signatures made from the fake signing key made with the same seed.
func MakeLocalUserVerifyingKeyOrBust ¶
func MakeLocalUserVerifyingKeyOrBust(name libkb.NormalizedUsername) VerifyingKey
MakeLocalUserVerifyingKeyOrBust makes a new verifying key corresponding to the signing key for this user.
func MakeVerifyingKey ¶
func MakeVerifyingKey(kid keybase1.KID) VerifyingKey
MakeVerifyingKey returns a VerifyingKey containing the given KID.
func (VerifyingKey) IsNil ¶
func (k VerifyingKey) IsNil() bool
IsNil returns true if the VerifyingKey is nil.
func (VerifyingKey) KID ¶
func (k VerifyingKey) KID() keybase1.KID
Needed by mdserver/server_test.go. TODO: Figure out how to avoid this.
func (VerifyingKey) MarshalBinary ¶
func (*VerifyingKey) UnmarshalBinary ¶
type WrapError ¶
type WrapError struct {
Err error
}
WrapError simply wraps an error in a fmt.Stringer interface, so that it can be reported.
type WriteAccessError ¶
type WriteAccessError struct {
User libkb.NormalizedUsername
Tlf CanonicalTlfName
Public bool
}
WriteAccessError indicates that the user tried to read from a top-level folder without read permission.
func (WriteAccessError) Errno ¶
func (e WriteAccessError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for WriteAccessError.
func (WriteAccessError) Error ¶
func (e WriteAccessError) Error() string
Error implements the error interface for WriteAccessError
type WriteRange ¶
type WriteRange struct {
Off uint64 `codec:"o"`
Len uint64 `codec:"l,omitempty"` // 0 for truncates
codec.UnknownFieldSetHandler
}
WriteRange represents a file modification. Len is 0 for a truncate.
func (WriteRange) Affects ¶
func (w WriteRange) Affects(other WriteRange) bool
Affects returns true if the regions affected by this write operation and `other` overlap in some way. Specifically, it returns true if:
- both operations are writes and their write ranges overlap;
- one operation is a write and one is a truncate, and the truncate is within the write's range or before it; or
- both operations are truncates.
func (WriteRange) End ¶
func (w WriteRange) End() uint64
End returns the index of the largest byte not affected by this write. It only makes sense to call this for non-truncates.
type WriterDeviceDateConflictRenamer ¶
type WriterDeviceDateConflictRenamer struct {
// contains filtered or unexported fields
}
WriterDeviceDateConflictRenamer renames a file using a username, device name, and date.
func (WriterDeviceDateConflictRenamer) ConflictRename ¶
func (cr WriterDeviceDateConflictRenamer) ConflictRename(op op, original string) string
ConflictRename implements the ConflictRename interface for TimeAndWriterConflictRenamer.
func (WriterDeviceDateConflictRenamer) ConflictRenameHelper ¶
func (WriterDeviceDateConflictRenamer) ConflictRenameHelper(t time.Time, user, device, original string) string
ConflictRenameHelper is a helper for ConflictRename especially useful from tests.
type WriterFlags ¶
type WriterFlags byte
WriterFlags bitfield.
const (
MetadataFlagUnmerged WriterFlags = 1 << iota
)
Possible flags set in the WriterFlags bitfield.
type WriterMetadataExtra ¶
type WriterMetadataExtra struct {
UnresolvedWriters []keybase1.SocialAssertion `codec:"uw,omitempty"`
codec.UnknownFieldSetHandler
}
WriterMetadataExtra stores more fields for WriterMetadata. (See WriterMetadata comments as to why this type is needed.)
type WriterMetadataV2 ¶
type WriterMetadataV2 struct {
// Serialized, possibly encrypted, version of the PrivateMetadata
SerializedPrivateMetadata []byte `codec:"data"`
// The last KB user with writer permissions to this TLF
// who modified this WriterMetadata
LastModifyingWriter keybase1.UID
// For public TLFs (since those don't have any keys at all).
Writers []keybase1.UID `codec:",omitempty"`
// For private TLFs. Writer key generations for this metadata. The
// most recent one is last in the array. Must be same length as
// BareRootMetadata.RKeys.
WKeys TLFWriterKeyGenerations `codec:",omitempty"`
// The directory ID, signed over to make verification easier
ID TlfID
// The branch ID, currently only set if this is in unmerged per-device history.
BID BranchID
// Flags
WFlags WriterFlags
// Estimated disk usage at this revision
DiskUsage uint64
// The total number of bytes in new blocks
RefBytes uint64
// The total number of bytes in unreferenced blocks
UnrefBytes uint64
Extra WriterMetadataExtra `codec:"x,omitempty,omitemptycheckstruct"`
}
WriterMetadataV2 stores the metadata for a TLF that is only editable by users with writer permissions.
NOTE: Don't add new fields to this type! Instead, add them to WriterMetadataExtra. This is because we want old clients to preserve unknown fields, and we're unable to do that for WriterMetadata directly because it's embedded in BareRootMetadata.
type WrongOpsError ¶
type WrongOpsError struct {
// contains filtered or unexported fields
}
WrongOpsError indicates that an unexpected path got passed into a FolderBranchOps instance
func (WrongOpsError) Error ¶
func (e WrongOpsError) Error() string
Error implements the error interface for WrongOpsError.
Source Files
¶
- auth_token.go
- bare_root_metadata.go
- bare_tlf_handle.go
- bcache.go
- block_id.go
- block_journal.go
- block_ops.go
- block_ops_constrained.go
- block_types.go
- branch_id.go
- bserver_disk.go
- bserver_errors.go
- bserver_measured.go
- bserver_memory.go
- bserver_remote.go
- bsplitter_simple.go
- codec.go
- config_local.go
- conflict_renamer.go
- conflict_resolver.go
- connection_status.go
- context.go
- cr_actions.go
- cr_chains.go
- crypto_client.go
- crypto_client_rpc.go
- crypto_common.go
- crypto_key_types.go
- crypto_local.go
- crypto_measured.go
- data_types.go
- dir_entry.go
- dirty_bcache.go
- dirty_file.go
- disk_journal.go
- errors.go
- errors_fuse.go
- fake_key.go
- favorites.go
- flag_size.go
- folder_block_manager.go
- folder_block_ops.go
- folder_branch_ops.go
- folder_branch_status.go
- hash.go
- identify_util.go
- init.go
- interfaces.go
- journal_block_cache.go
- journal_block_server.go
- journal_md_ops.go
- journal_server.go
- journal_server_util.go
- kbfs_ops.go
- kbpki_client.go
- kcache_measured.go
- kcache_null.go
- key_bundle.go
- key_manager.go
- key_ops.go
- key_server_local.go
- key_server_measured.go
- keybase_daemon.go
- keybase_daemon_local.go
- keybase_daemon_rpc.go
- keybase_service_base.go
- keybase_service_measured.go
- keycache.go
- leveldb.go
- leveled_mutex.go
- md_id.go
- md_id_journal.go
- md_journal.go
- md_ops.go
- md_util.go
- mdcache.go
- mdserver_disk.go
- mdserver_errors.go
- mdserver_local_shared.go
- mdserver_memory.go
- mdserver_remote.go
- mdserver_tlf_storage.go
- merkle.go
- node.go
- node_cache.go
- observer_list.go
- ops.go
- rekey_queue.go
- repeated_wait_group.go
- reporter_kbpki.go
- reporter_simple.go
- root_certs.go
- root_metadata.go
- root_metadata_test_util.go
- rwlocker.go
- shared_keybase_transport.go
- state_checker.go
- test_common.go
- test_dynamodb_runner.go
- test_stallers.go
- tlf_edit_history.go
- tlf_handle.go
- tlf_handle_extension.go
- tlf_id.go
- util.go
- version.go
- wall_clock.go