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 BackgroundContextWithCancellationDelayer() context.Context
- func BoolForString(s string) bool
- func BuildCanonicalPath(pathType PathType, paths ...string) string
- func CheckConfigAndShutdown(ctx context.Context, t logger.TestLogBackend, config Config)
- func CheckTlfHandleOffline(ctx context.Context, name string, public bool) error
- func CleanupCancellationDelayer(ctx context.Context) 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 DumpBareRootMetadata(codec kbfscodec.Codec, brmd BareRootMetadata) (string, error)
- func DumpExtraMetadata(codec kbfscodec.Codec, extra ExtraMetadata) (string, error)
- func DumpPrivateMetadata(codec kbfscodec.Codec, pmd PrivateMetadata) (string, error)
- func EnableDelayedCancellationWithGracePeriod(ctx context.Context, timeout time.Duration) error
- func EncodeRootMetadataSigned(codec kbfscodec.Codec, rmds *RootMetadataSigned) ([]byte, error)
- func ForceQuotaReclamationForTesting(config Config, folderBranch FolderBranch) error
- func GetCurrentUserInfoIfPossible(ctx context.Context, kbpki KBPKI, isPublic bool) (libkb.NormalizedUsername, keybase1.UID, error)
- func GetDefaultsUsageString(ctx Context) string
- func GetLocalUsageString() string
- func GetRemoteUsageString() string
- 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 MakeLocalUserCryptPrivateKeyOrBust(name libkb.NormalizedUsername) kbfscrypto.CryptPrivateKey
- func MakeLocalUserCryptPublicKeyOrBust(name libkb.NormalizedUsername) kbfscrypto.CryptPublicKey
- func MakeLocalUserSigningKeyOrBust(name libkb.NormalizedUsername) kbfscrypto.SigningKey
- func MakeLocalUserVerifyingKeyOrBust(name libkb.NormalizedUsername) kbfscrypto.VerifyingKey
- func MakeRandomRequestID() (string, error)
- func NewContextReplayable(ctx context.Context, change CtxReplayFunc) context.Context
- func NewContextWithCancellationDelayer(ctx context.Context) (newCtx context.Context, err error)
- func NewContextWithReplayFrom(ctx context.Context) (context.Context, error)
- func NewReadAccessError(h *TlfHandle, username libkb.NormalizedUsername, filename string) error
- func NewRekeyPermissionError(dir *TlfHandle, username libkb.NormalizedUsername) error
- func NewSharedKeybaseConnection(kbCtx Context, config Config, handler rpc.ConnectionHandler) *rpc.Connection
- func NewWriteAccessError(h *TlfHandle, username libkb.NormalizedUsername, filename string) error
- func NewWriteUnsupportedError(filename string) error
- func PutBlockCheckQuota(ctx context.Context, bserv BlockServer, reporter Reporter, tlfID tlf.ID, ...) error
- func ReadyBlock(ctx context.Context, bcache BlockCache, bops BlockOps, crypto cryptoPure, ...) (info BlockInfo, plainSize int, readyBlockData ReadyBlockData, err error)
- func RegisterOps(codec kbfscodec.Codec)
- func ResetRootBlock(ctx context.Context, config Config, currentUID keybase1.UID, rmd *RootMetadata) (Block, BlockInfo, ReadyBlockData, error)
- 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, maxStalls int) (onStalled <-chan struct{}, unstall chan<- struct{}, newCtx context.Context)
- func StallMDOp(ctx context.Context, config Config, stalledOp StallableMDOp, maxStalls int) (onStalled <-chan struct{}, unstall chan<- struct{}, newCtx context.Context)
- func SwitchDeviceForLocalUserOrBust(t logger.TestLogBackend, config Config, index int)
- func TLFJournalEnabled(config Config, tlfID tlf.ID) bool
- func VersionString() string
- func WaitForTLFJournal(ctx context.Context, config Config, tlfID tlf.ID, log logger.Logger) error
- type BadCryptoError
- type BadCryptoMDError
- type BadDataError
- type BadMDError
- type BadSplitError
- type BadTLFNameError
- type BareRootMetadata
- type BareRootMetadataV2
- func (md *BareRootMetadataV2) AddDiskUsage(diskUsage uint64)
- func (md *BareRootMetadataV2) AddKeyGeneration(codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata, ...) (nextExtra ExtraMetadata, serverHalves UserDeviceKeyServerHalves, err error)
- 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 kbfscodec.Codec) (MutableBareRootMetadata, error)
- func (md *BareRootMetadataV2) DiskUsage() uint64
- func (md *BareRootMetadataV2) FinalizeRekey(_ cryptoPure, _ ExtraMetadata) error
- func (md *BareRootMetadataV2) GetCurrentTLFPublicKey(_ ExtraMetadata) (kbfscrypto.TLFPublicKey, error)
- func (md *BareRootMetadataV2) GetHistoricTLFCryptKey(_ cryptoPure, _ KeyGen, _ kbfscrypto.TLFCryptKey, _ ExtraMetadata) (kbfscrypto.TLFCryptKey, error)
- func (md *BareRootMetadataV2) GetLastModifyingUser() keybase1.UID
- func (md *BareRootMetadataV2) GetPrevRoot() MdID
- func (md *BareRootMetadataV2) GetSerializedPrivateMetadata() []byte
- func (md *BareRootMetadataV2) GetSerializedWriterMetadata(codec kbfscodec.Codec) ([]byte, error)
- func (md *BareRootMetadataV2) GetTLFCryptKeyParams(keyGen KeyGen, user keybase1.UID, key kbfscrypto.CryptPublicKey, ...) (kbfscrypto.TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, ...)
- func (md *BareRootMetadataV2) GetTLFReaderKeyBundleID() TLFReaderKeyBundleID
- func (md *BareRootMetadataV2) GetTLFWriterKeyBundleID() TLFWriterKeyBundleID
- func (md *BareRootMetadataV2) GetUnresolvedParticipants() []keybase1.SocialAssertion
- func (md *BareRootMetadataV2) GetUserDevicePublicKeys(_ ExtraMetadata) (writerDeviceKeys, readerDeviceKeys UserDevicePublicKeys, err error)
- func (md *BareRootMetadataV2) IsFinal() bool
- func (md *BareRootMetadataV2) IsLastModifiedBy(uid keybase1.UID, key kbfscrypto.VerifyingKey) error
- func (md *BareRootMetadataV2) IsReader(user keybase1.UID, deviceKID keybase1.KID, _ ExtraMetadata) bool
- func (md *BareRootMetadataV2) IsRekeySet() bool
- func (md *BareRootMetadataV2) IsUnmergedSet() bool
- func (md *BareRootMetadataV2) IsValidAndSigned(codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata) error
- func (md *BareRootMetadataV2) IsValidRekeyRequest(codec kbfscodec.Codec, prevBareMd BareRootMetadata, user keybase1.UID, ...) (bool, error)
- func (md *BareRootMetadataV2) IsWriter(user keybase1.UID, deviceKID keybase1.KID, _ ExtraMetadata) bool
- func (md *BareRootMetadataV2) IsWriterMetadataCopiedSet() bool
- func (md *BareRootMetadataV2) KeyGenerationsToUpdate() (KeyGen, KeyGen)
- func (md *BareRootMetadataV2) LastModifyingWriter() keybase1.UID
- func (md *BareRootMetadataV2) LatestKeyGeneration() KeyGen
- func (md *BareRootMetadataV2) MakeBareTlfHandle(_ ExtraMetadata) (tlf.Handle, error)
- func (md *BareRootMetadataV2) MakeSuccessorCopy(codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata, ...) (MutableBareRootMetadata, ExtraMetadata, error)
- func (md *BareRootMetadataV2) MergedStatus() MergeStatus
- func (md *BareRootMetadataV2) PromoteReaders(readersToPromote map[keybase1.UID]bool, _ ExtraMetadata) error
- func (md *BareRootMetadataV2) RefBytes() uint64
- func (md *BareRootMetadataV2) RevisionNumber() MetadataRevision
- func (md *BareRootMetadataV2) RevokeRemovedDevices(updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, _ ExtraMetadata) (ServerHalfRemovalInfo, error)
- func (md *BareRootMetadataV2) SetBranchID(bid BranchID)
- func (md *BareRootMetadataV2) SetConflictInfo(ci *tlf.HandleExtension)
- func (md *BareRootMetadataV2) SetDiskUsage(diskUsage uint64)
- func (md *BareRootMetadataV2) SetFinalBit()
- func (md *BareRootMetadataV2) SetFinalizedInfo(fi *tlf.HandleExtension)
- 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 tlf.ID)
- 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) SetWriters(writers []keybase1.UID)
- func (md *BareRootMetadataV2) SignWriterMetadataInternally(ctx context.Context, codec kbfscodec.Codec, signer kbfscrypto.Signer) error
- func (md *BareRootMetadataV2) StoresHistoricTLFCryptKeys() bool
- func (md *BareRootMetadataV2) TlfHandleExtensions() (extensions []tlf.HandleExtension)
- func (md *BareRootMetadataV2) TlfID() tlf.ID
- func (md *BareRootMetadataV2) UnrefBytes() uint64
- func (md *BareRootMetadataV2) UpdateKeyBundles(crypto cryptoPure, _ ExtraMetadata, ...) ([]UserDeviceKeyServerHalves, error)
- func (md *BareRootMetadataV2) Version() MetadataVer
- type BareRootMetadataV3
- func (md *BareRootMetadataV3) AddDiskUsage(diskUsage uint64)
- func (md *BareRootMetadataV3) AddKeyGeneration(codec kbfscodec.Codec, crypto cryptoPure, currExtra ExtraMetadata, ...) (nextExtra ExtraMetadata, serverHalves UserDeviceKeyServerHalves, err error)
- func (md *BareRootMetadataV3) AddRefBytes(refBytes uint64)
- func (md *BareRootMetadataV3) AddUnrefBytes(unrefBytes uint64)
- func (md *BareRootMetadataV3) BID() BranchID
- func (md *BareRootMetadataV3) CheckValidSuccessor(currID MdID, nextMd BareRootMetadata) error
- func (md *BareRootMetadataV3) CheckValidSuccessorForServer(currID MdID, nextMd BareRootMetadata) error
- func (md *BareRootMetadataV3) ClearFinalBit()
- func (md *BareRootMetadataV3) ClearRekeyBit()
- func (md *BareRootMetadataV3) ClearWriterMetadataCopiedBit()
- func (md *BareRootMetadataV3) DeepCopy(codec kbfscodec.Codec) (MutableBareRootMetadata, error)
- func (md *BareRootMetadataV3) DiskUsage() uint64
- func (md *BareRootMetadataV3) FinalizeRekey(crypto cryptoPure, extra ExtraMetadata) error
- func (md *BareRootMetadataV3) GetCurrentTLFPublicKey(extra ExtraMetadata) (kbfscrypto.TLFPublicKey, error)
- func (md *BareRootMetadataV3) GetHistoricTLFCryptKey(crypto cryptoPure, keyGen KeyGen, currentKey kbfscrypto.TLFCryptKey, ...) (kbfscrypto.TLFCryptKey, error)
- func (md *BareRootMetadataV3) GetLastModifyingUser() keybase1.UID
- func (md *BareRootMetadataV3) GetPrevRoot() MdID
- func (md *BareRootMetadataV3) GetSerializedPrivateMetadata() []byte
- func (md *BareRootMetadataV3) GetSerializedWriterMetadata(codec kbfscodec.Codec) ([]byte, error)
- func (md *BareRootMetadataV3) GetTLFCryptKeyParams(keyGen KeyGen, user keybase1.UID, key kbfscrypto.CryptPublicKey, ...) (kbfscrypto.TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, ...)
- func (md *BareRootMetadataV3) GetTLFReaderKeyBundleID() TLFReaderKeyBundleID
- func (md *BareRootMetadataV3) GetTLFWriterKeyBundleID() TLFWriterKeyBundleID
- func (md *BareRootMetadataV3) GetUnresolvedParticipants() []keybase1.SocialAssertion
- func (md *BareRootMetadataV3) GetUserDevicePublicKeys(extra ExtraMetadata) (writerDeviceKeys, readerDeviceKeys UserDevicePublicKeys, err error)
- func (md *BareRootMetadataV3) IsFinal() bool
- func (md *BareRootMetadataV3) IsLastModifiedBy(uid keybase1.UID, key kbfscrypto.VerifyingKey) error
- func (md *BareRootMetadataV3) IsReader(user keybase1.UID, deviceKID keybase1.KID, extra ExtraMetadata) bool
- func (md *BareRootMetadataV3) IsRekeySet() bool
- func (md *BareRootMetadataV3) IsUnmergedSet() bool
- func (md *BareRootMetadataV3) IsValidAndSigned(codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata) error
- func (md *BareRootMetadataV3) IsValidRekeyRequest(codec kbfscodec.Codec, prevBareMd BareRootMetadata, user keybase1.UID, ...) (bool, error)
- func (md *BareRootMetadataV3) IsWriter(user keybase1.UID, deviceKID keybase1.KID, extra ExtraMetadata) bool
- func (md *BareRootMetadataV3) IsWriterMetadataCopiedSet() bool
- func (md *BareRootMetadataV3) KeyGenerationsToUpdate() (KeyGen, KeyGen)
- func (md *BareRootMetadataV3) LastModifyingWriter() keybase1.UID
- func (md *BareRootMetadataV3) LatestKeyGeneration() KeyGen
- func (md *BareRootMetadataV3) MakeBareTlfHandle(extra ExtraMetadata) (tlf.Handle, error)
- func (md *BareRootMetadataV3) MakeSuccessorCopy(codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata, _ MetadataVer, ...) (MutableBareRootMetadata, ExtraMetadata, error)
- func (md *BareRootMetadataV3) MergedStatus() MergeStatus
- func (md *BareRootMetadataV3) PromoteReaders(readersToPromote map[keybase1.UID]bool, extra ExtraMetadata) error
- func (md *BareRootMetadataV3) RefBytes() uint64
- func (md *BareRootMetadataV3) RevisionNumber() MetadataRevision
- func (md *BareRootMetadataV3) RevokeRemovedDevices(updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, extra ExtraMetadata) (ServerHalfRemovalInfo, error)
- func (md *BareRootMetadataV3) SetBranchID(bid BranchID)
- func (md *BareRootMetadataV3) SetConflictInfo(ci *tlf.HandleExtension)
- func (md *BareRootMetadataV3) SetDiskUsage(diskUsage uint64)
- func (md *BareRootMetadataV3) SetFinalBit()
- func (md *BareRootMetadataV3) SetFinalizedInfo(fi *tlf.HandleExtension)
- func (md *BareRootMetadataV3) SetLastModifyingUser(user keybase1.UID)
- func (md *BareRootMetadataV3) SetLastModifyingWriter(user keybase1.UID)
- func (md *BareRootMetadataV3) SetPrevRoot(mdID MdID)
- func (md *BareRootMetadataV3) SetRefBytes(refBytes uint64)
- func (md *BareRootMetadataV3) SetRekeyBit()
- func (md *BareRootMetadataV3) SetRevision(revision MetadataRevision)
- func (md *BareRootMetadataV3) SetSerializedPrivateMetadata(spmd []byte)
- func (md *BareRootMetadataV3) SetTlfID(tlf tlf.ID)
- func (md *BareRootMetadataV3) SetUnmerged()
- func (md *BareRootMetadataV3) SetUnrefBytes(unrefBytes uint64)
- func (md *BareRootMetadataV3) SetUnresolvedReaders(readers []keybase1.SocialAssertion)
- func (md *BareRootMetadataV3) SetUnresolvedWriters(writers []keybase1.SocialAssertion)
- func (md *BareRootMetadataV3) SetWriterMetadataCopiedBit()
- func (md *BareRootMetadataV3) SetWriters(writers []keybase1.UID)
- func (md *BareRootMetadataV3) SignWriterMetadataInternally(ctx context.Context, codec kbfscodec.Codec, signer kbfscrypto.Signer) error
- func (md *BareRootMetadataV3) StoresHistoricTLFCryptKeys() bool
- func (md *BareRootMetadataV3) TlfHandleExtensions() (extensions []tlf.HandleExtension)
- func (md *BareRootMetadataV3) TlfID() tlf.ID
- func (md *BareRootMetadataV3) UnrefBytes() uint64
- func (md *BareRootMetadataV3) UpdateKeyBundles(crypto cryptoPure, extra ExtraMetadata, ...) ([]UserDeviceKeyServerHalves, error)
- func (md *BareRootMetadataV3) Version() MetadataVer
- type Block
- type BlockCache
- type BlockCacheLifetime
- type BlockCacheSimple
- type BlockCacheStandard
- func (b *BlockCacheStandard) CheckForKnownPtr(tlf tlf.ID, block *FileBlock) (BlockPointer, error)
- func (b *BlockCacheStandard) DeleteKnownPtr(tlf tlf.ID, block *FileBlock) error
- func (b *BlockCacheStandard) DeletePermanent(id kbfsblock.ID) error
- func (b *BlockCacheStandard) DeleteTransient(ptr BlockPointer, tlf tlf.ID) error
- func (b *BlockCacheStandard) Get(ptr BlockPointer) (Block, error)
- func (b *BlockCacheStandard) GetCleanBytesCapacity() (capacity uint64)
- func (b *BlockCacheStandard) GetWithPrefetch(ptr BlockPointer) (Block, bool, BlockCacheLifetime, error)
- func (b *BlockCacheStandard) Put(ptr BlockPointer, tlf tlf.ID, block Block, lifetime BlockCacheLifetime) error
- func (b *BlockCacheStandard) PutWithPrefetch(ptr BlockPointer, tlf tlf.ID, block Block, lifetime BlockCacheLifetime, ...) (err error)
- func (b *BlockCacheStandard) SetCleanBytesCapacity(capacity uint64)
- 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 BlockDecodeError
- type BlockDirectType
- type BlockInfo
- type BlockOps
- type BlockOpsConstrained
- type BlockOpsStandard
- func (b *BlockOpsStandard) Archive(ctx context.Context, tlfID tlf.ID, ptrs []BlockPointer) error
- func (b *BlockOpsStandard) Delete(ctx context.Context, tlfID tlf.ID, ptrs []BlockPointer) (liveCounts map[kbfsblock.ID]int, err error)
- func (b *BlockOpsStandard) Get(ctx context.Context, kmd KeyMetadata, blockPtr BlockPointer, block Block, ...) error
- func (b *BlockOpsStandard) Prefetcher() Prefetcher
- func (b *BlockOpsStandard) Ready(ctx context.Context, kmd KeyMetadata, block Block) (id kbfsblock.ID, plainSize int, readyBlockData ReadyBlockData, err error)
- func (b *BlockOpsStandard) Shutdown()
- func (b *BlockOpsStandard) TogglePrefetcher(ctx context.Context, enable bool) error
- type BlockPointer
- type BlockRef
- type BlockServer
- type BlockServerDisk
- func (b *BlockServerDisk) AddBlockReference(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) error
- func (b *BlockServerDisk) ArchiveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error)
- func (b *BlockServerDisk) Get(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (data []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error)
- func (b *BlockServerDisk) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error)
- func (b *BlockServerDisk) IsUnflushed(ctx context.Context, tlfID tlf.ID, _ kbfsblock.ID) (bool, error)
- func (b *BlockServerDisk) Put(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context, ...) (err error)
- func (b *BlockServerDisk) RefreshAuthToken(_ context.Context)
- func (b *BlockServerDisk) RemoveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (liveCounts map[kbfsblock.ID]int, err error)
- func (b *BlockServerDisk) Shutdown()
- type BlockServerMeasured
- func (b BlockServerMeasured) AddBlockReference(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (err error)
- func (b BlockServerMeasured) ArchiveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error)
- func (b BlockServerMeasured) Get(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error)
- func (b BlockServerMeasured) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error)
- func (b BlockServerMeasured) IsUnflushed(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID) (isUnflushed bool, err error)
- func (b BlockServerMeasured) Put(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context, ...) (err error)
- func (b BlockServerMeasured) RefreshAuthToken(ctx context.Context)
- func (b BlockServerMeasured) RemoveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (liveCounts map[kbfsblock.ID]int, err error)
- func (b BlockServerMeasured) Shutdown()
- type BlockServerMemory
- func (b *BlockServerMemory) AddBlockReference(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (err error)
- func (b *BlockServerMemory) ArchiveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error)
- func (b *BlockServerMemory) Get(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (data []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error)
- func (b *BlockServerMemory) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error)
- func (b *BlockServerMemory) IsUnflushed(ctx context.Context, tlfID tlf.ID, _ kbfsblock.ID) (bool, error)
- func (b *BlockServerMemory) Put(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context, ...) (err error)
- func (b *BlockServerMemory) RefreshAuthToken(_ context.Context)
- func (b *BlockServerMemory) RemoveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (liveCounts map[kbfsblock.ID]int, err error)
- func (b *BlockServerMemory) Shutdown()
- type BlockServerRemote
- func (b *BlockServerRemote) AddBlockReference(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (err error)
- func (b *BlockServerRemote) ArchiveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error)
- func (b *BlockServerRemote) Get(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error)
- func (b *BlockServerRemote) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error)
- func (b *BlockServerRemote) IsUnflushed(_ context.Context, _ tlf.ID, _ kbfsblock.ID) (bool, error)
- func (b *BlockServerRemote) Put(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context, ...) (err error)
- func (b *BlockServerRemote) RefreshAuthToken(ctx context.Context)
- func (b *BlockServerRemote) RemoteAddress() string
- func (b *BlockServerRemote) RemoveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (liveCounts map[kbfsblock.ID]int, err error)
- func (b *BlockServerRemote) Shutdown()
- type BlockSplitter
- type BlockSplitterSimple
- func (b *BlockSplitterSimple) CheckSplit(block *FileBlock) int64
- func (b *BlockSplitterSimple) CopyUntilSplit(block *FileBlock, lastBlock bool, data []byte, off int64) int64
- func (b *BlockSplitterSimple) MaxPtrsPerBlock() int
- func (b *BlockSplitterSimple) ShouldEmbedBlockChanges(bc *BlockChanges) bool
- type BranchID
- type BranchName
- type CRAbandonStagedBranchError
- type CRWrapError
- type CanonicalTlfName
- type Clock
- type CoalescingContext
- type CommonBlock
- func (cb *CommonBlock) DataVersion() DataVer
- func (cb *CommonBlock) DeepCopy() CommonBlock
- func (cb *CommonBlock) GetEncodedSize() uint32
- func (cb *CommonBlock) NewEmpty() Block
- func (cb *CommonBlock) Set(other Block)
- func (cb *CommonBlock) SetEncodedSize(size uint32)
- func (cb *CommonBlock) ToCommonBlock() *CommonBlock
- type Config
- type 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() kbfscodec.Codec
- func (c *ConfigLocal) ConflictRenamer() ConflictRenamer
- func (c *ConfigLocal) Crypto() Crypto
- func (c *ConfigLocal) DataVersion() DataVer
- func (c *ConfigLocal) DelayedCancellationGracePeriod() time.Duration
- func (c *ConfigLocal) DirtyBlockCache() DirtyBlockCache
- func (c *ConfigLocal) DoBackgroundFlushes() bool
- func (c *ConfigLocal) EnableJournaling(ctx context.Context, journalRoot string, bws TLFJournalBackgroundWorkStatus) error
- func (c *ConfigLocal) KBFSOps() KBFSOps
- func (c *ConfigLocal) KBPKI() KBPKI
- func (c *ConfigLocal) KeyBundleCache() KeyBundleCache
- 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) MaxNameBytes() uint32
- func (c *ConfigLocal) MetadataVersion() MetadataVer
- func (c *ConfigLocal) MetricsRegistry() metrics.Registry
- func (c *ConfigLocal) Notifier() Notifier
- func (c *ConfigLocal) QuotaReclamationMinHeadAge() time.Duration
- 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 kbfscodec.Codec)
- func (c *ConfigLocal) SetConflictRenamer(cr ConflictRenamer)
- func (c *ConfigLocal) SetCrypto(cr Crypto)
- func (c *ConfigLocal) SetDelayedCancellationGracePeriod(d time.Duration)
- 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) SetKeyBundleCache(k KeyBundleCache)
- 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) SetMDCache(m MDCache)
- func (c *ConfigLocal) SetMDOps(m MDOps)
- func (c *ConfigLocal) SetMDServer(m MDServer)
- func (c *ConfigLocal) SetMetadataVersion(mdVer MetadataVer)
- func (c *ConfigLocal) SetMetricsRegistry(r metrics.Registry)
- func (c *ConfigLocal) SetNotifier(n Notifier)
- func (c *ConfigLocal) SetRekeyQueue(r RekeyQueue)
- func (c *ConfigLocal) SetRekeyWithPromptWaitTime(d time.Duration)
- func (c *ConfigLocal) SetReporter(r Reporter)
- func (c *ConfigLocal) SetTLFValidDuration(r time.Duration)
- func (c *ConfigLocal) Shutdown(ctx context.Context) error
- func (c *ConfigLocal) TLFValidDuration() time.Duration
- type ConflictRenamer
- type ConflictResolver
- func (cr *ConflictResolver) BeginNewBranch()
- func (cr *ConflictResolver) Pause()
- func (cr *ConflictResolver) Resolve(unmerged MetadataRevision, merged MetadataRevision)
- func (cr *ConflictResolver) Restart(baseCtx context.Context)
- func (cr *ConflictResolver) Shutdown()
- func (cr *ConflictResolver) Wait(ctx context.Context) error
- type Context
- type ContextAlreadyHasCancellationDelayerError
- type Crypto
- type CryptoClient
- func (c *CryptoClient) DecryptTLFCryptKeyClientHalf(ctx context.Context, publicKey kbfscrypto.TLFEphemeralPublicKey, ...) (clientHalf kbfscrypto.TLFCryptKeyClientHalf, err error)
- func (c *CryptoClient) DecryptTLFCryptKeyClientHalfAny(ctx context.Context, keys []EncryptedTLFCryptKeyClientAndEphemeral, ...) (clientHalf kbfscrypto.TLFCryptKeyClientHalf, index int, err error)
- func (c *CryptoClient) Shutdown()
- func (c *CryptoClient) Sign(ctx context.Context, msg []byte) (sigInfo kbfscrypto.SignatureInfo, err error)
- func (c *CryptoClient) SignForKBFS(ctx context.Context, msg []byte) (sigInfo kbfscrypto.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 kbfscrypto.BlockCryptKey, block Block) error
- func (c CryptoCommon) DecryptMerkleLeaf(encryptedLeaf EncryptedMerkleLeaf, privKey kbfscrypto.TLFPrivateKey, ...) (*MerkleLeaf, error)
- func (c CryptoCommon) DecryptPrivateMetadata(encryptedPmd EncryptedPrivateMetadata, key kbfscrypto.TLFCryptKey) (PrivateMetadata, error)
- func (c CryptoCommon) DecryptTLFCryptKeys(encKeys EncryptedTLFCryptKeys, key kbfscrypto.TLFCryptKey) ([]kbfscrypto.TLFCryptKey, error)
- func (c CryptoCommon) EncryptBlock(block Block, key kbfscrypto.BlockCryptKey) (plainSize int, encryptedBlock EncryptedBlock, err error)
- func (c CryptoCommon) EncryptMerkleLeaf(leaf MerkleLeaf, pubKey kbfscrypto.TLFPublicKey, nonce *[24]byte, ...) (EncryptedMerkleLeaf, error)
- func (c CryptoCommon) EncryptPrivateMetadata(pmd PrivateMetadata, key kbfscrypto.TLFCryptKey) (encryptedPmd EncryptedPrivateMetadata, err error)
- func (c CryptoCommon) EncryptTLFCryptKeyClientHalf(privateKey kbfscrypto.TLFEphemeralPrivateKey, ...) (encryptedClientHalf EncryptedTLFCryptKeyClientHalf, err error)
- func (c CryptoCommon) EncryptTLFCryptKeys(oldKeys []kbfscrypto.TLFCryptKey, key kbfscrypto.TLFCryptKey) (encryptedKeys EncryptedTLFCryptKeys, err error)
- func (c CryptoCommon) GetTLFCryptKeyServerHalfID(user keybase1.UID, devicePubKey kbfscrypto.CryptPublicKey, ...) (TLFCryptKeyServerHalfID, error)
- func (c CryptoCommon) MakeBlockRefNonce() (nonce kbfsblock.RefNonce, err error)
- func (c CryptoCommon) MakeMdID(md BareRootMetadata) (MdID, error)
- func (c CryptoCommon) MakeMerkleHash(md *RootMetadataSigned) (MerkleHash, error)
- func (c CryptoCommon) MakeRandomBlockCryptKeyServerHalf() (kbfscrypto.BlockCryptKeyServerHalf, error)
- func (c CryptoCommon) MakeRandomBranchID() (BranchID, error)
- func (c CryptoCommon) MakeRandomTLFCryptKeyServerHalf() (serverHalf kbfscrypto.TLFCryptKeyServerHalf, err error)
- func (c CryptoCommon) MakeRandomTLFEphemeralKeys() (kbfscrypto.TLFEphemeralPublicKey, kbfscrypto.TLFEphemeralPrivateKey, error)
- func (c CryptoCommon) MakeRandomTLFKeys() (kbfscrypto.TLFPublicKey, kbfscrypto.TLFPrivateKey, kbfscrypto.TLFCryptKey, ...)
- func (c CryptoCommon) MakeRandomTlfID(isPublic bool) (tlf.ID, error)
- func (c CryptoCommon) MakeTLFReaderKeyBundleID(rkb TLFReaderKeyBundleV3) (TLFReaderKeyBundleID, error)
- func (c CryptoCommon) MakeTLFWriterKeyBundleID(wkb TLFWriterKeyBundleV3) (TLFWriterKeyBundleID, error)
- func (c CryptoCommon) MakeTemporaryBlockID() (kbfsblock.ID, error)
- func (c CryptoCommon) VerifyTLFCryptKeyServerHalfID(serverHalfID TLFCryptKeyServerHalfID, user keybase1.UID, ...) error
- type CryptoLocal
- func (c CryptoLocal) DecryptTLFCryptKeyClientHalf(ctx context.Context, publicKey kbfscrypto.TLFEphemeralPublicKey, ...) (kbfscrypto.TLFCryptKeyClientHalf, error)
- func (c CryptoLocal) DecryptTLFCryptKeyClientHalfAny(ctx context.Context, keys []EncryptedTLFCryptKeyClientAndEphemeral, _ bool) (clientHalf kbfscrypto.TLFCryptKeyClientHalf, index int, err error)
- func (c CryptoLocal) Shutdown()
- type CryptoMeasured
- type CtxBackgroundSyncKeyType
- type CtxCRTagKey
- type CtxCancellationDelayerKeyType
- type CtxFBMTagKey
- type CtxFBOTagKey
- type CtxJournalTagKey
- type CtxKeybaseServiceTagKey
- type CtxMDSRTagKey
- type CtxNotReplayableError
- type CtxRekeyTagKey
- type CtxReplayFunc
- type CtxReplayKeyType
- type DataVer
- type DeviceKeyInfoMapV2
- type DeviceKeyInfoMapV3
- type DeviceKeyServerHalves
- type DevicePublicKeys
- type DirBlock
- type DirEntry
- type DirNotEmptyError
- type DirTooBigError
- type DirtyBlockCache
- type DirtyBlockCacheStandard
- func (d *DirtyBlockCacheStandard) BlockSyncFinished(_ tlf.ID, size int64)
- func (d *DirtyBlockCacheStandard) Delete(_ tlf.ID, ptr BlockPointer, branch BranchName) error
- func (d *DirtyBlockCacheStandard) Get(_ tlf.ID, ptr BlockPointer, branch BranchName) (Block, error)
- func (d *DirtyBlockCacheStandard) IsAnyDirty(_ tlf.ID) bool
- func (d *DirtyBlockCacheStandard) IsDirty(_ tlf.ID, ptr BlockPointer, branch BranchName) (isDirty bool)
- func (d *DirtyBlockCacheStandard) Put(_ tlf.ID, ptr BlockPointer, branch BranchName, block Block) error
- func (d *DirtyBlockCacheStandard) RequestPermissionToDirty(ctx context.Context, _ tlf.ID, estimatedDirtyBytes int64) (DirtyPermChan, error)
- func (d *DirtyBlockCacheStandard) ShouldForceSync(_ tlf.ID) bool
- func (d *DirtyBlockCacheStandard) Shutdown() error
- func (d *DirtyBlockCacheStandard) SyncFinished(_ tlf.ID, size int64)
- func (d *DirtyBlockCacheStandard) UpdateSyncingBytes(_ tlf.ID, size int64)
- func (d *DirtyBlockCacheStandard) UpdateUnsyncedBytes(_ tlf.ID, newUnsyncedBytes int64, wasSyncing bool)
- type DirtyPermChan
- type DisallowedPrefixError
- type EmptyNameError
- type EncryptedBlock
- type EncryptedMerkleLeaf
- type EncryptedPrivateMetadata
- type EncryptedTLFCryptKeyClientAndEphemeral
- type EncryptedTLFCryptKeyClientHalf
- type EncryptedTLFCryptKeys
- type EncryptionVer
- type EntryInfo
- type EntryType
- type ErrDiskLimitTimeout
- type ErrorFileAccessError
- type ErrorModeType
- type Excl
- type ExclOnUnmergedError
- type ExtendedIdentifyAlreadyExists
- type ExtraMetadata
- type ExtraMetadataV3
- func (extra ExtraMetadataV3) DeepCopy(codec kbfscodec.Codec) (ExtraMetadata, error)
- func (extra ExtraMetadataV3) GetReaderKeyBundle() TLFReaderKeyBundleV3
- func (extra ExtraMetadataV3) GetWriterKeyBundle() TLFWriterKeyBundleV3
- func (extra ExtraMetadataV3) MakeSuccessorCopy(codec kbfscodec.Codec) (ExtraMetadata, error)
- func (extra ExtraMetadataV3) MetadataVersion() MetadataVer
- 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 FileTooBigForCRError
- type FolderBranch
- type FolderBranchStatus
- type GCOp
- type ImmutableBareRootMetadata
- type ImmutableRootMetadata
- type IncompatibleHandleError
- type InconsistentEncodedSizeError
- type IndirectDirPtr
- type IndirectFilePtr
- type InitParams
- type InvalidBlockRefError
- type InvalidBranchID
- type InvalidDataVersionError
- type InvalidKeyGenerationError
- type InvalidMetadataVersionError
- type InvalidNonceError
- type InvalidOpError
- type InvalidParentPathError
- type InvalidPathError
- type InvalidPublicTLFOperation
- type JournalServer
- func (j *JournalServer) Disable(ctx context.Context, tlfID tlf.ID) (wasEnabled bool, err error)
- func (j *JournalServer) DisableAuto(ctx context.Context) error
- func (j *JournalServer) Enable(ctx context.Context, tlfID tlf.ID, bws TLFJournalBackgroundWorkStatus) error
- func (j *JournalServer) EnableAuto(ctx context.Context) error
- func (j *JournalServer) EnableExistingJournals(ctx context.Context, currentUID keybase1.UID, ...) (err error)
- func (j *JournalServer) Flush(ctx context.Context, tlfID tlf.ID) (err error)
- func (j *JournalServer) JournalStatus(tlfID tlf.ID) (TLFJournalStatus, error)
- func (j *JournalServer) JournalStatusWithPaths(ctx context.Context, tlfID tlf.ID, cpp chainsPathPopulator) (TLFJournalStatus, error)
- func (j *JournalServer) PauseBackgroundWork(ctx context.Context, tlfID tlf.ID)
- func (j *JournalServer) ResumeBackgroundWork(ctx context.Context, tlfID tlf.ID)
- func (j *JournalServer) Status(ctx context.Context) (JournalServerStatus, []tlf.ID)
- func (j *JournalServer) Wait(ctx context.Context, tlfID tlf.ID) (err error)
- type JournalServerStatus
- type KBFSOps
- type KBFSOpsStandard
- func (fs *KBFSOpsStandard) AddFavorite(ctx context.Context, fav Favorite) error
- func (fs *KBFSOpsStandard) ClearPrivateFolderMD(ctx context.Context)
- 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) ForceFastForward(ctx context.Context)
- 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) GetNodeMetadata(ctx context.Context, node Node) (NodeMetadata, 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 []kbfscrypto.TLFCryptKey, id tlf.ID, err error)
- func (fs *KBFSOpsStandard) GetTLFID(ctx context.Context, tlfHandle *TlfHandle) (id tlf.ID, 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) PushStatusChange()
- 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 tlf.ID) 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(ctx context.Context) 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 []kbfscrypto.CryptPublicKey, err error)
- func (k *KBPKIClient) GetCurrentCryptPublicKey(ctx context.Context) (kbfscrypto.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) (kbfscrypto.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 kbfscrypto.VerifyingKey) error
- func (k *KBPKIClient) HasVerifyingKey(ctx context.Context, uid keybase1.UID, verifyingKey kbfscrypto.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 KeyBundleCache
- type KeyBundleCacheMeasured
- func (b KeyBundleCacheMeasured) GetTLFReaderKeyBundle(tlfID tlf.ID, bundleID TLFReaderKeyBundleID) (rkb *TLFReaderKeyBundleV3, err error)
- func (b KeyBundleCacheMeasured) GetTLFWriterKeyBundle(tlfID tlf.ID, bundleID TLFWriterKeyBundleID) (wkb *TLFWriterKeyBundleV3, err error)
- func (b KeyBundleCacheMeasured) PutTLFReaderKeyBundle(tlfID tlf.ID, bundleID TLFReaderKeyBundleID, rkb TLFReaderKeyBundleV3)
- func (b KeyBundleCacheMeasured) PutTLFWriterKeyBundle(tlfID tlf.ID, bundleID TLFWriterKeyBundleID, wkb TLFWriterKeyBundleV3)
- type KeyBundleCacheStandard
- func (k *KeyBundleCacheStandard) GetTLFReaderKeyBundle(tlf tlf.ID, bundleID TLFReaderKeyBundleID) (*TLFReaderKeyBundleV3, error)
- func (k *KeyBundleCacheStandard) GetTLFWriterKeyBundle(tlf tlf.ID, bundleID TLFWriterKeyBundleID) (*TLFWriterKeyBundleV3, error)
- func (k *KeyBundleCacheStandard) PutTLFReaderKeyBundle(tlf tlf.ID, bundleID TLFReaderKeyBundleID, rkb TLFReaderKeyBundleV3)
- func (k *KeyBundleCacheStandard) PutTLFWriterKeyBundle(tlf tlf.ID, bundleID TLFWriterKeyBundleID, wkb TLFWriterKeyBundleV3)
- type KeyCache
- type KeyCacheHitError
- type KeyCacheMeasured
- type KeyCacheMissError
- type KeyCacheStandard
- type KeyGen
- type KeyHalfMismatchError
- type KeyManager
- type KeyManagerStandard
- func (km *KeyManagerStandard) GetTLFCryptKeyForBlockDecryption(ctx context.Context, kmd KeyMetadata, blockPtr BlockPointer) (tlfCryptKey kbfscrypto.TLFCryptKey, err error)
- func (km *KeyManagerStandard) GetTLFCryptKeyForEncryption(ctx context.Context, kmd KeyMetadata) (tlfCryptKey kbfscrypto.TLFCryptKey, err error)
- func (km *KeyManagerStandard) GetTLFCryptKeyForMDDecryption(ctx context.Context, kmdToDecrypt, kmdWithKeys KeyMetadata) (tlfCryptKey kbfscrypto.TLFCryptKey, err error)
- func (km *KeyManagerStandard) GetTLFCryptKeyOfAllGenerations(ctx context.Context, kmd KeyMetadata) (keys []kbfscrypto.TLFCryptKey, err error)
- func (km *KeyManagerStandard) Rekey(ctx context.Context, md *RootMetadata, promptPaper bool) (mdChanged bool, cryptKey *kbfscrypto.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, ...) (kbfscrypto.TLFCryptKeyServerHalf, error)
- func (k *KeyOpsStandard) PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) 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, ...) (serverHalf kbfscrypto.TLFCryptKeyServerHalf, err error)
- func (ks *KeyServerLocal) PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) 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, ...) (serverHalf kbfscrypto.TLFCryptKeyServerHalf, err error)
- func (b KeyServerMeasured) PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) (err error)
- func (b KeyServerMeasured) Shutdown()
- type KeybaseDaemonLocal
- func (k *KeybaseDaemonLocal) CurrentSession(ctx context.Context, sessionID int) (SessionInfo, error)
- func (k *KeybaseDaemonLocal) EstablishMountDir(ctx context.Context) (string, 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) NotifySyncStatus(ctx context.Context, _ *keybase1.FSPathSyncStatus) 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) EstablishMountDir(ctx context.Context) (string, error)
- func (k *KeybaseServiceBase) FSEditListRequest(ctx context.Context, req keybase1.FSEditListRequest) (err error)
- func (k *KeybaseServiceBase) FSSyncStatusRequest(ctx context.Context, req keybase1.FSSyncStatusRequest) (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) GetPublicCanonicalTLFNameAndID(ctx context.Context, query keybase1.TLFQuery) (res keybase1.CanonicalTLFNameAndIDWithBreaks, err error)
- func (k *KeybaseServiceBase) GetTLFCryptKeys(ctx context.Context, query keybase1.TLFQuery) (res keybase1.GetTLFCryptKeysRes, 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) NotifySyncStatus(ctx context.Context, status *keybase1.FSPathSyncStatus) 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) EstablishMountDir(ctx context.Context) (string, 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) NotifySyncStatus(ctx context.Context, status *keybase1.FSPathSyncStatus) (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
- func (md *MDCacheStandard) Delete(tlf tlf.ID, rev MetadataRevision, bid BranchID)
- func (md *MDCacheStandard) Get(tlf tlf.ID, rev MetadataRevision, bid BranchID) (ImmutableRootMetadata, error)
- func (md *MDCacheStandard) Put(rmd ImmutableRootMetadata) error
- func (md *MDCacheStandard) Replace(newRmd ImmutableRootMetadata, oldBID BranchID) error
- type MDDiskUsageMismatch
- type MDJournalConflictError
- type MDMismatchError
- type MDMissingDataError
- type MDOps
- type MDOpsStandard
- func (md *MDOpsStandard) GetForHandle(ctx context.Context, handle *TlfHandle, mStatus MergeStatus) (id tlf.ID, rmd ImmutableRootMetadata, err error)
- func (md *MDOpsStandard) GetForTLF(ctx context.Context, id tlf.ID) (ImmutableRootMetadata, error)
- func (md *MDOpsStandard) GetLatestHandleForTLF(ctx context.Context, id tlf.ID) (tlf.Handle, error)
- func (md *MDOpsStandard) GetRange(ctx context.Context, id tlf.ID, start, stop MetadataRevision) ([]ImmutableRootMetadata, error)
- func (md *MDOpsStandard) GetUnmergedForTLF(ctx context.Context, id tlf.ID, bid BranchID) (ImmutableRootMetadata, error)
- func (md *MDOpsStandard) GetUnmergedRange(ctx context.Context, id tlf.ID, bid BranchID, start, stop MetadataRevision) ([]ImmutableRootMetadata, error)
- func (md *MDOpsStandard) PruneBranch(ctx context.Context, id tlf.ID, 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)
- func (md *MDOpsStandard) ResolveBranch(ctx context.Context, id tlf.ID, bid BranchID, _ []kbfsblock.ID, ...) (MdID, error)
- type MDPrevRootMismatch
- type MDRevisionMismatch
- type MDServer
- type MDServerDisconnected
- type MDServerDisk
- func (md *MDServerDisk) CancelRegistration(_ context.Context, id tlf.ID)
- func (md *MDServerDisk) CheckForRekeys(ctx context.Context) <-chan error
- func (md *MDServerDisk) DisableRekeyUpdatesForTesting()
- func (md *MDServerDisk) GetForHandle(ctx context.Context, handle tlf.Handle, mStatus MergeStatus) (tlf.ID, *RootMetadataSigned, error)
- func (md *MDServerDisk) GetForTLF(ctx context.Context, id tlf.ID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
- func (md *MDServerDisk) GetKeyBundles(ctx context.Context, tlfID tlf.ID, wkbID TLFWriterKeyBundleID, ...) (*TLFWriterKeyBundleV3, *TLFReaderKeyBundleV3, error)
- func (md *MDServerDisk) GetLatestHandleForTLF(ctx context.Context, id tlf.ID) (tlf.Handle, error)
- func (md *MDServerDisk) GetRange(ctx context.Context, id tlf.ID, 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 tlf.ID, bid BranchID) error
- func (md *MDServerDisk) Put(ctx context.Context, rmds *RootMetadataSigned, extra ExtraMetadata) error
- func (md *MDServerDisk) RefreshAuthToken(ctx context.Context)
- func (md *MDServerDisk) RegisterForUpdate(ctx context.Context, id tlf.ID, currHead MetadataRevision) (<-chan error, error)
- func (md *MDServerDisk) Shutdown()
- func (md *MDServerDisk) TruncateLock(ctx context.Context, id tlf.ID) (bool, error)
- func (md *MDServerDisk) TruncateUnlock(ctx context.Context, id tlf.ID) (bool, error)
- type MDServerError
- type MDServerErrorBadRequest
- type MDServerErrorCannotReadFinalizedTLF
- type MDServerErrorConditionFailed
- type MDServerErrorConflictDiskUsage
- type MDServerErrorConflictFolderMapping
- type MDServerErrorConflictPrevRoot
- type MDServerErrorConflictRevision
- type MDServerErrorLocked
- type MDServerErrorThrottle
- type MDServerErrorTooManyFoldersCreated
- type MDServerErrorUnauthorized
- type MDServerErrorUnwrapper
- type MDServerErrorWriteAccess
- type MDServerMemory
- func (md *MDServerMemory) CancelRegistration(_ context.Context, id tlf.ID)
- func (md *MDServerMemory) CheckForRekeys(ctx context.Context) <-chan error
- func (md *MDServerMemory) DisableRekeyUpdatesForTesting()
- func (md *MDServerMemory) GetForHandle(ctx context.Context, handle tlf.Handle, mStatus MergeStatus) (tlf.ID, *RootMetadataSigned, error)
- func (md *MDServerMemory) GetForTLF(ctx context.Context, id tlf.ID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
- func (md *MDServerMemory) GetKeyBundles(ctx context.Context, tlfID tlf.ID, wkbID TLFWriterKeyBundleID, ...) (*TLFWriterKeyBundleV3, *TLFReaderKeyBundleV3, error)
- func (md *MDServerMemory) GetLatestHandleForTLF(ctx context.Context, id tlf.ID) (tlf.Handle, error)
- func (md *MDServerMemory) GetRange(ctx context.Context, id tlf.ID, 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 tlf.ID, bid BranchID) error
- func (md *MDServerMemory) Put(ctx context.Context, rmds *RootMetadataSigned, extra ExtraMetadata) error
- func (md *MDServerMemory) RefreshAuthToken(ctx context.Context)
- func (md *MDServerMemory) RegisterForUpdate(ctx context.Context, id tlf.ID, currHead MetadataRevision) (<-chan error, error)
- func (md *MDServerMemory) Shutdown()
- func (md *MDServerMemory) TruncateLock(ctx context.Context, id tlf.ID) (bool, error)
- func (md *MDServerMemory) TruncateUnlock(ctx context.Context, id tlf.ID) (bool, error)
- type MDServerRemote
- func (md *MDServerRemote) CancelRegistration(ctx context.Context, id tlf.ID)
- 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(ctx context.Context, arg keybase1.FolderNeedsRekeyArg) error
- func (md *MDServerRemote) FoldersNeedRekey(ctx context.Context, requests []keybase1.RekeyRequest) error
- func (md *MDServerRemote) GetForHandle(ctx context.Context, handle tlf.Handle, mStatus MergeStatus) (tlf.ID, *RootMetadataSigned, error)
- func (md *MDServerRemote) GetForTLF(ctx context.Context, id tlf.ID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
- func (md *MDServerRemote) GetKeyBundles(ctx context.Context, tlf tlf.ID, wkbID TLFWriterKeyBundleID, ...) (*TLFWriterKeyBundleV3, *TLFReaderKeyBundleV3, error)
- func (md *MDServerRemote) GetLatestHandleForTLF(ctx context.Context, id tlf.ID) (tlf.Handle, error)
- func (md *MDServerRemote) GetRange(ctx context.Context, id tlf.ID, bid BranchID, mStatus MergeStatus, ...) ([]*RootMetadataSigned, error)
- func (md *MDServerRemote) GetTLFCryptKeyServerHalf(ctx context.Context, serverHalfID TLFCryptKeyServerHalfID, ...) (serverHalf kbfscrypto.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 tlf.ID, bid BranchID) error
- func (md *MDServerRemote) Put(ctx context.Context, rmds *RootMetadataSigned, extra ExtraMetadata) error
- func (md *MDServerRemote) PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) error
- func (md *MDServerRemote) RefreshAuthToken(ctx context.Context)
- func (md *MDServerRemote) RegisterForUpdate(ctx context.Context, id tlf.ID, 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 tlf.ID) (bool, error)
- func (md *MDServerRemote) TruncateUnlock(ctx context.Context, id tlf.ID) (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, maxStalls int)
- func (s *NaïveStaller) StallMDOp(stalledOp StallableMDOp, maxStalls int, stallDelegate bool)
- 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 NoCancellationDelayerError
- type NoChainFoundError
- type NoCurrentSessionError
- type NoKeysError
- type NoMergedMDError
- type NoSigChainError
- type NoSuchBlockError
- type NoSuchFolderListError
- type NoSuchMDError
- type NoSuchNameError
- type NoSuchTlfHandleError
- type NoSuchUserError
- type Node
- type NodeCache
- type NodeChange
- type NodeID
- type NodeMetadata
- 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) DelUnrefBlock(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 PathType
- type PreferredTlfName
- type Prefetcher
- type PrivateMetadata
- type ReadAccessError
- type ReadOnlyRootMetadata
- type ReadyBlockData
- type RekeyConflictError
- type RekeyIncompleteError
- type RekeyPermissionError
- type RekeyQueue
- type RekeyQueueStandard
- type RenameAcrossDirsError
- type ReportedError
- type Reporter
- type ReporterKBPKI
- func (r *ReporterKBPKI) Notify(ctx context.Context, notification *keybase1.FSNotification)
- func (r *ReporterKBPKI) NotifySyncStatus(ctx context.Context, status *keybase1.FSPathSyncStatus)
- func (r *ReporterKBPKI) ReportErr(ctx context.Context, tlfName CanonicalTlfName, public bool, mode ErrorModeType, ...)
- func (r *ReporterKBPKI) Shutdown()
- type ReporterSimple
- func (r *ReporterSimple) AllKnownErrors() []ReportedError
- func (r *ReporterSimple) Notify(_ context.Context, _ *keybase1.FSNotification)
- func (r *ReporterSimple) NotifySyncStatus(_ context.Context, _ *keybase1.FSPathSyncStatus)
- func (r *ReporterSimple) ReportErr(ctx context.Context, _ CanonicalTlfName, _ bool, _ ErrorModeType, err error)
- func (r *ReporterSimple) Shutdown()
- type RootMetadata
- func (md *RootMetadata) AddDiskUsage(diskUsage uint64)
- func (md *RootMetadata) AddKeyGeneration(codec kbfscodec.Codec, crypto cryptoPure, wKeys, rKeys UserDevicePublicKeys, ...) (serverHalves UserDeviceKeyServerHalves, err 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) Extra() ExtraMetadata
- func (md *RootMetadata) GetBareRootMetadata() BareRootMetadata
- func (md *RootMetadata) GetHistoricTLFCryptKey(crypto cryptoPure, keyGen KeyGen, currentKey kbfscrypto.TLFCryptKey) (kbfscrypto.TLFCryptKey, error)
- func (md *RootMetadata) GetSerializedPrivateMetadata() []byte
- func (md *RootMetadata) GetSerializedWriterMetadata(codec kbfscodec.Codec) ([]byte, error)
- func (md *RootMetadata) GetTLFCryptKeyParams(keyGen KeyGen, user keybase1.UID, key kbfscrypto.CryptPublicKey) (kbfscrypto.TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, ...)
- func (md *RootMetadata) GetTLFReaderKeyBundleID() TLFReaderKeyBundleID
- func (md *RootMetadata) GetTLFWriterKeyBundleID() TLFWriterKeyBundleID
- func (md *RootMetadata) GetTlfHandle() *TlfHandle
- func (md *RootMetadata) HasKeyForUser(user keybase1.UID) (bool, error)
- 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) KeyGenerationsToUpdate() (KeyGen, KeyGen)
- func (md *RootMetadata) LastModifyingUser() keybase1.UID
- func (md *RootMetadata) LastModifyingWriter() keybase1.UID
- func (md *RootMetadata) LatestKeyGeneration() KeyGen
- func (md *RootMetadata) MakeBareTlfHandle() (tlf.Handle, error)
- func (md *RootMetadata) MakeSuccessor(ctx context.Context, latestMDVer MetadataVer, codec kbfscodec.Codec, ...) (*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 *tlf.HandleExtension)
- func (md *RootMetadata) SetDiskUsage(diskUsage uint64)
- func (md *RootMetadata) SetFinalBit()
- func (md *RootMetadata) SetFinalizedInfo(fi *tlf.HandleExtension)
- func (md *RootMetadata) SetLastGCRevision(rev MetadataRevision)
- 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 tlf.ID)
- 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) SetWriters(writers []keybase1.UID)
- func (md *RootMetadata) StoresHistoricTLFCryptKeys() bool
- func (md *RootMetadata) TlfID() tlf.ID
- func (md *RootMetadata) UnrefBytes() uint64
- func (md *RootMetadata) Version() MetadataVer
- type RootMetadataSigned
- func (rmds *RootMetadataSigned) GetWriterMetadataSigInfo() kbfscrypto.SignatureInfo
- func (rmds *RootMetadataSigned) IsLastModifiedBy(uid keybase1.UID, key kbfscrypto.VerifyingKey) error
- func (rmds *RootMetadataSigned) IsValidAndSigned(codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata) error
- func (rmds *RootMetadataSigned) MakeFinalCopy(codec kbfscodec.Codec, now time.Time, finalizedInfo *tlf.HandleExtension) (*RootMetadataSigned, error)
- func (rmds *RootMetadataSigned) MerkleHash(crypto cryptoPure) (MerkleHash, error)
- func (rmds *RootMetadataSigned) Version() MetadataVer
- type ServerHalfRemovalInfo
- type SessionInfo
- type SharedKeybaseTransport
- type ShutdownHappenedError
- type SizeFlag
- type StallableBlockOp
- type StallableMDOp
- type StateChecker
- type StatusUpdate
- type TLFCryptKeyInfo
- type TLFCryptKeyNotPerDeviceEncrypted
- type TLFCryptKeyServerHalfID
- type TLFJournalBackgroundWorkStatus
- type TLFJournalStatus
- type TLFReaderKeyBundleID
- type TLFReaderKeyBundleV2
- type TLFReaderKeyBundleV3
- type TLFReaderKeyGenerationsV2
- type TLFUpdateHistory
- type TLFWriterKeyBundleID
- type TLFWriterKeyBundleV2
- type TLFWriterKeyBundleV3
- type TLFWriterKeyGenerationsV2
- func (wkg TLFWriterKeyGenerationsV2) IsWriter(user keybase1.UID, deviceKID keybase1.KID) bool
- func (wkg TLFWriterKeyGenerationsV2) LatestKeyGeneration() KeyGen
- func (wkg TLFWriterKeyGenerationsV2) ToTLFWriterKeyBundleV3(codec kbfscodec.Codec, crypto cryptoPure, ...) (TLFWriterKeyBundleV2, TLFWriterKeyBundleV3, error)
- 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 MakeTlfHandle(ctx context.Context, bareHandle tlf.Handle, nug normalizedUsernameGetter) (*TlfHandle, error)
- func ParseTlfHandle(ctx context.Context, kbpki KBPKI, name string, public bool) (*TlfHandle, error)
- func ParseTlfHandlePreferred(ctx context.Context, kbpki KBPKI, name string, public bool) (*TlfHandle, error)
- func (h TlfHandle) ConflictInfo() *tlf.HandleExtension
- func (h TlfHandle) Equals(codec kbfscodec.Codec, other TlfHandle) (bool, error)
- func (h TlfHandle) EqualsIgnoreName(codec kbfscodec.Codec, other TlfHandle) (bool, error)
- func (h TlfHandle) Extensions() (extensions []tlf.HandleExtension)
- func (h TlfHandle) FinalizedInfo() *tlf.HandleExtension
- func (h TlfHandle) FirstResolvedWriter() keybase1.UID
- func (h *TlfHandle) GetCanonicalName() CanonicalTlfName
- func (h *TlfHandle) GetCanonicalPath() string
- func (h TlfHandle) GetPreferredFormat(username libkb.NormalizedUsername) PreferredTlfName
- 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) MutuallyResolvesTo(ctx context.Context, codec kbfscodec.Codec, resolver resolver, other TlfHandle, ...) error
- 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 kbfscodec.Codec, resolver resolver, other TlfHandle) (resolvesTo bool, partialResolvedH *TlfHandle, err error)
- func (h *TlfHandle) SetFinalizedInfo(info *tlf.HandleExtension)
- func (h TlfHandle) ToBareHandle() (tlf.Handle, error)
- func (h TlfHandle) ToBareHandleOrBust() tlf.Handle
- func (h *TlfHandle) ToFavorite() Favorite
- func (h TlfHandle) UnresolvedReaders() []keybase1.SocialAssertion
- func (h TlfHandle) UnresolvedWriters() []keybase1.SocialAssertion
- func (h TlfHandle) WithUpdatedConflictInfo(codec kbfscodec.Codec, info *tlf.HandleExtension) (*TlfHandle, error)
- type TlfHandleFinalizedError
- type TlfNameNotCanonical
- type TlfWriterEdits
- type TooLowByteCountError
- type UnexpectedUnmergedPutError
- type UnknownEncryptionVer
- type UnmergedError
- type UnmergedSelfConflictError
- type UnverifiableTlfUpdateError
- type UpdateSummary
- type UserDeviceKeyInfoMapV2
- type UserDeviceKeyInfoMapV3
- type UserDeviceKeyServerHalves
- type UserDevicePublicKeys
- type UserInfo
- type WrapError
- type WriteAccessError
- type WriteRange
- type WriteUnsupportedError
- type WriterDeviceDateConflictRenamer
- type WriterFlags
- type WriterMetadataExtraV2
- type WriterMetadataV2
- type WriterMetadataV3
- 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 ( // 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" LoginStatusUpdateName = "login" LogoutStatusUpdateName = "logout" )
Service names used in ConnectionStatus.
const ( // ReaderSep is the string that separates readers from writers in a // TLF name. ReaderSep = "#" // PublicUIDName is the name given to keybase1.PublicUID. This string // should correspond to an illegal or reserved Keybase user name. PublicUIDName = "_public" )
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 // StatusCodeMDServerErrorTooManyFoldersCreated is the error code to // indicate that the user has created more folders than their limit. StatusCodeMDServerErrorTooManyFoldersCreated = 2811 // StatusCodeMDServerErrorCannotReadFinalizedTLF is the error code // to indicate that a reader has requested to read a TLF ID that // has been finalized, which isn't allowed. StatusCodeMDServerErrorCannotReadFinalizedTLF = 2812 )
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 = "https://s3-us-west-2.amazonaws.com/dynamodb-local/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" StallableBlockPut StallableBlockOp = "Put" 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" StallableMDResolveBranch StallableMDOp = "ResolveBranch" )
stallable Block Ops and MD Ops
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 CtxJournalOpID = "JID"
CtxJournalOpID is the display name for the unique operation enqueued journal 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 ( // ForcedBranchSquashThreshold is the minimum number of MD // revisions in the journal that will trigger an automatic branch // conversion (and subsequent resolution). ForcedBranchSquashThreshold = 20 )
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 RPCReconnectInterval = 2 * time.Second
RPCReconnectInterval specifies the time between reconnect attempts for RPC Connections.
const Version = "1.0.2"
Version is the current version (should be MAJOR.MINOR.PATCH)
Variables ¶
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 PendingLocalSquashBranchID = BranchID{ [BranchIDByteLen]byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}
PendingLocalSquashBranchID indicates a local branch that is not in known conflict with the master branch, but just needs to be squashed locally.
var PrereleaseBuild string
PrereleaseBuild is set at compile time for prerelease builds
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 BackgroundContextWithCancellationDelayer ¶
BackgroundContextWithCancellationDelayer generate a "Background" context that is cancellation delayable
func BoolForString ¶
BoolForString returns false if trimmed string is "" (empty), "0", "false", or "no"
func BuildCanonicalPath ¶
BuildCanonicalPath returns a canonical path for a path components. This a canonical path and may need to be converted to a platform specific path, for example, on Windows, this might correspond to k:\private\username.
func CheckConfigAndShutdown ¶
func CheckConfigAndShutdown( ctx context.Context, 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 CleanupCancellationDelayer ¶
CleanupCancellationDelayer cleans up a context (ctx) that is cancellation delayable and makes the go routine spawned in NewContextWithCancellationDelayer exit. As part of the cleanup, this also causes the cancellation delayable context to be canceled, no matter whether the timeout passed into the EnableDelayedCancellationWithGracePeriod has passed or not.
Ideally, the parent ctx's cancelFunc is always called upon completion of handling a request, in which case this wouldn't be necessary.
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 DumpBareRootMetadata ¶
func DumpBareRootMetadata( codec kbfscodec.Codec, brmd BareRootMetadata) (string, error)
DumpBareRootMetadata returns a detailed dump of the given BareRootMetadata's contents.
func DumpExtraMetadata ¶
func DumpExtraMetadata( codec kbfscodec.Codec, extra ExtraMetadata) (string, error)
DumpExtraMetadata returns a detailed dump of the given ExtraMetadata's contents.
func DumpPrivateMetadata ¶
func DumpPrivateMetadata( codec kbfscodec.Codec, pmd PrivateMetadata) (string, error)
DumpPrivateMetadata returns a detailed dump of the given PrivateMetadata's contents.
func EnableDelayedCancellationWithGracePeriod ¶
EnableDelayedCancellationWithGracePeriod can be called on a "cancellation delayable" context produced by NewContextWithCancellationDelayer, to enable delayed cancellation for ctx. This is useful to indicate that the operation(s) associated with the context has entered a critical state, and it should not be canceled until after timeout or CleanupCancellationDelayer is called.
Note that if EnableDelayedCancellationWithGracePeriod is called for the second time, and the grace period has started due to a cancellation, the grace period would not be extended (i.e. timeout has no effect in this case). Although in this case, no error is returned, since the delayed cancellation is already enabled.
func EncodeRootMetadataSigned ¶
func EncodeRootMetadataSigned( codec kbfscodec.Codec, rmds *RootMetadataSigned) ([]byte, error)
EncodeRootMetadataSigned serializes a metadata block. This should be used instead of directly calling codec.Encode(), as it handles some version-specific quirks.
func ForceQuotaReclamationForTesting ¶
func ForceQuotaReclamationForTesting(config Config, folderBranch FolderBranch) error
ForceQuotaReclamationForTesting kicks off quota reclamation under the given config, for the given folder-branch.
func GetCurrentUserInfoIfPossible ¶
func GetCurrentUserInfoIfPossible(ctx context.Context, kbpki KBPKI, isPublic bool) (libkb.NormalizedUsername, keybase1.UID, error)
GetCurrentUserInfoIfPossible returns the current username and UID from kbpki.GetCurrentUserInfo. If isPublic is true NoCurrentSessionError is ignored and empty username and uid will be returned. If it is false all errors are returned.
func GetDefaultsUsageString ¶
GetDefaultsUsageString returns a string describing the default values of flags based on the run mode.
func GetLocalUsageString ¶
func GetLocalUsageString() string
GetLocalUsageString returns a string describing the flags to use to run in a local testing environment.
func GetRemoteUsageString ¶
func GetRemoteUsageString() string
GetRemoteUsageString returns a string describing the flags to use to run against remote KBFS servers.
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 MakeLocalUserCryptPrivateKeyOrBust ¶
func MakeLocalUserCryptPrivateKeyOrBust( name libkb.NormalizedUsername) kbfscrypto.CryptPrivateKey
MakeLocalUserCryptPrivateKeyOrBust returns a unique private encryption key for this user.
func MakeLocalUserCryptPublicKeyOrBust ¶
func MakeLocalUserCryptPublicKeyOrBust( name libkb.NormalizedUsername) kbfscrypto.CryptPublicKey
MakeLocalUserCryptPublicKeyOrBust returns the public key corresponding to the crypt private key for this user.
func MakeLocalUserSigningKeyOrBust ¶
func MakeLocalUserSigningKeyOrBust( name libkb.NormalizedUsername) kbfscrypto.SigningKey
MakeLocalUserSigningKeyOrBust returns a unique signing key for this user.
func MakeLocalUserVerifyingKeyOrBust ¶
func MakeLocalUserVerifyingKeyOrBust( name libkb.NormalizedUsername) kbfscrypto.VerifyingKey
MakeLocalUserVerifyingKeyOrBust makes a new verifying key corresponding to the signing key for this user.
func MakeRandomRequestID ¶
MakeRandomRequestID generates a random ID suitable for tagging a request in KBFS, and very likely to be universally unique.
func NewContextReplayable ¶
func NewContextReplayable( ctx context.Context, change CtxReplayFunc) context.Context
NewContextReplayable creates a new context from ctx, with change applied. It also makes this change replayable by NewContextWithReplayFrom. When replayed, the resulting context is replayable as well.
It is important that all WithValue-ish mutations on ctx is done "replayably" (with NewContextReplayable) if any delayed cancellation is used, e.g. through EnableDelayedCancellationWithGracePeriod,
func NewContextWithCancellationDelayer ¶
NewContextWithCancellationDelayer creates a new context out of ctx. All replay functions attached to ctx are run on the new context. In addition, the new context is made "cancellation delayable". That is, it disconnects the cancelFunc from ctx, and watch for the cancellation. When cancellation happens, it checks if delayed cancellation is enabled for the associated context. If so, it waits until it's disabled before cancelling the new context. This provides a hacky way to allow finer control over cancellation.
Note that, it's important to call context.WithCancel (or its friends) before this function if those cancellations need to be controllable ("cancellation delayable"). Otherwise, the new cancelFunc is inherently NOT ("cancellation delayable").
If this function is called, it is caller's responsibility to either 1) cancel ctx (the context passed in); or 2) call CleanupCancellationDelayer; when operations associated with the context is done. Otherwise it leaks go routines!
func NewContextWithReplayFrom ¶
NewContextWithReplayFrom constructs a new context out of ctx by calling all attached replay functions. This disconnects any existing context.CancelFunc.
func NewReadAccessError ¶
func NewReadAccessError(h *TlfHandle, username libkb.NormalizedUsername, filename string) 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 NewWriteAccessError ¶
func NewWriteAccessError(h *TlfHandle, username libkb.NormalizedUsername, filename string) error
NewWriteAccessError is an access error trying to write a file
func NewWriteUnsupportedError ¶
NewWriteUnsupportedError returns unsupported error trying to write a file
func PutBlockCheckQuota ¶
func PutBlockCheckQuota(ctx context.Context, bserv BlockServer, reporter Reporter, tlfID tlf.ID, blockPtr BlockPointer, readyBlockData ReadyBlockData, tlfName CanonicalTlfName) error
PutBlockCheckQuota is a thin wrapper around putBlockToServer (which calls either bserver.Put or bserver.AddBlockReference) that reports quota errors.
func ReadyBlock ¶
func ReadyBlock(ctx context.Context, bcache BlockCache, bops BlockOps, crypto cryptoPure, kmd KeyMetadata, block Block, uid keybase1.UID) ( info BlockInfo, plainSize int, readyBlockData ReadyBlockData, err error)
ReadyBlock is a thin wrapper around BlockOps.Ready() that handles checking for duplicates.
func RegisterOps ¶
RegisterOps registers all op types with the given codec.
func ResetRootBlock ¶
func ResetRootBlock(ctx context.Context, config Config, currentUID keybase1.UID, rmd *RootMetadata) ( Block, BlockInfo, ReadyBlockData, error)
ResetRootBlock creates a new empty dir block and sets the given metadata's root block to it.
func RestartCRForTesting ¶
func RestartCRForTesting(baseCtx context.Context, config Config, folderBranch FolderBranch) error
RestartCRForTesting re-enables conflict resolution for the given folder. baseCtx must have a cancellation delayer.
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, maxStalls int) ( 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, maxStalls int) ( 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
func TLFJournalEnabled ¶
TLFJournalEnabled returns true if journaling is enabled for the given TLF.
Types ¶
type BadCryptoError ¶
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 ¶
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 ¶
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 ¶
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() tlf.ID // KeyGenerationsToUpdate returns a range that has to be // updated when rekeying. start is included, but end is not // included. This range can be empty (i.e., start >= end), in // which case there's nothing to update, i.e. the TLF is // public, or there aren't any existing key generations. KeyGenerationsToUpdate() (start KeyGen, end KeyGen) // 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 kbfscodec.Codec, prevMd BareRootMetadata, user keybase1.UID, prevExtra, extra ExtraMetadata) (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, extra ExtraMetadata) bool // IsReader returns whether or not the user+device is an authorized reader. IsReader(user keybase1.UID, deviceKID keybase1.KID, extra ExtraMetadata) bool // DeepCopy returns a deep copy of the underlying data structure. DeepCopy(codec kbfscodec.Codec) (MutableBareRootMetadata, error) // MakeSuccessorCopy returns a newly constructed successor // copy to this metadata revision. It differs from DeepCopy // in that it can perform an up conversion to a new metadata // version. tlfCryptKeyGetter should be a function that // returns a list of TLFCryptKeys for all key generations in // ascending order. MakeSuccessorCopy(codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata, latestMDVer MetadataVer, tlfCryptKeyGetter func() ([]kbfscrypto.TLFCryptKey, error), isReadableAndWriter bool) (mdCopy MutableBareRootMetadata, extraCopy ExtraMetadata, err 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 tlf.Handle for this // BareRootMetadata. Should be used only by servers and MDOps. MakeBareTlfHandle(extra ExtraMetadata) (tlf.Handle, error) // TlfHandleExtensions returns a list of handle extensions associated with the TLf. TlfHandleExtensions() (extensions []tlf.HandleExtension) // GetDevicePublicKeys returns the kbfscrypto.CryptPublicKeys // for all known users and devices. Returns an error if the // TLF is public. GetUserDevicePublicKeys(extra ExtraMetadata) ( writers, readers UserDevicePublicKeys, err error) // 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 kbfscrypto.CryptPublicKey, extra ExtraMetadata) ( kbfscrypto.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 kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata) 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 kbfscrypto.VerifyingKey) error // LastModifyingWriter return the UID of the last user to modify the writer metadata. LastModifyingWriter() keybase1.UID // 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 kbfscodec.Codec) ([]byte, error) // Version returns the metadata version. Version() MetadataVer // GetCurrentTLFPublicKey returns the TLF public key for the // current key generation. GetCurrentTLFPublicKey(ExtraMetadata) (kbfscrypto.TLFPublicKey, error) // GetUnresolvedParticipants returns any unresolved readers // and writers present in this revision of metadata. The // returned array should be safe to modify by the caller. GetUnresolvedParticipants() []keybase1.SocialAssertion // GetTLFWriterKeyBundleID returns the ID of the externally-stored writer key bundle, or the zero value if // this object stores it internally. GetTLFWriterKeyBundleID() TLFWriterKeyBundleID // GetTLFReaderKeyBundleID returns the ID of the externally-stored reader key bundle, or the zero value if // this object stores it internally. GetTLFReaderKeyBundleID() TLFReaderKeyBundleID // StoresHistoricTLFCryptKeys returns whether or not history keys are symmetrically encrypted; if not, they're // encrypted per-device. StoresHistoricTLFCryptKeys() bool // GetHistoricTLFCryptKey attempts to symmetrically decrypt the key at the given // generation using the current generation's TLFCryptKey. GetHistoricTLFCryptKey(c cryptoPure, keyGen KeyGen, currentKey kbfscrypto.TLFCryptKey, extra ExtraMetadata) ( kbfscrypto.TLFCryptKey, error) }
BareRootMetadata is a read-only interface to the bare serializeable MD that is signed by the reader or writer.
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 kbfscrypto.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 TLFReaderKeyGenerationsV2 `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 *tlf.HandleExtension `codec:"ci,omitempty"` // FinalizedInfo is set if there are no more valid writer keys capable // of writing to the given folder. FinalizedInfo *tlf.HandleExtension `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 MakeInitialBareRootMetadataV2 ¶
MakeInitialBareRootMetadataV2 creates a new BareRootMetadataV2 object with revision MetadataRevisionInitial, and the given TLF ID and handle. Note that if the given ID/handle are private, rekeying must be done separately.
func (*BareRootMetadataV2) AddDiskUsage ¶
func (md *BareRootMetadataV2) AddDiskUsage(diskUsage uint64)
AddDiskUsage implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) AddKeyGeneration ¶
func (md *BareRootMetadataV2) AddKeyGeneration(codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata, updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, ePubKey kbfscrypto.TLFEphemeralPublicKey, ePrivKey kbfscrypto.TLFEphemeralPrivateKey, pubKey kbfscrypto.TLFPublicKey, currCryptKey, nextCryptKey kbfscrypto.TLFCryptKey) ( nextExtra ExtraMetadata, serverHalves UserDeviceKeyServerHalves, err error)
AddKeyGeneration 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 kbfscodec.Codec) (MutableBareRootMetadata, 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) FinalizeRekey ¶
func (md *BareRootMetadataV2) FinalizeRekey( _ cryptoPure, _ ExtraMetadata) error
FinalizeRekey implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetCurrentTLFPublicKey ¶
func (md *BareRootMetadataV2) GetCurrentTLFPublicKey( _ ExtraMetadata) (kbfscrypto.TLFPublicKey, error)
GetCurrentTLFPublicKey implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetHistoricTLFCryptKey ¶
func (md *BareRootMetadataV2) GetHistoricTLFCryptKey( _ cryptoPure, _ KeyGen, _ kbfscrypto.TLFCryptKey, _ ExtraMetadata) ( kbfscrypto.TLFCryptKey, error)
GetHistoricTLFCryptKey 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 kbfscodec.Codec) ([]byte, error)
GetSerializedWriterMetadata implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetTLFCryptKeyParams ¶
func (md *BareRootMetadataV2) GetTLFCryptKeyParams( keyGen KeyGen, user keybase1.UID, key kbfscrypto.CryptPublicKey, _ ExtraMetadata) ( kbfscrypto.TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, TLFCryptKeyServerHalfID, bool, error)
GetTLFCryptKeyParams implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetTLFReaderKeyBundleID ¶
func (md *BareRootMetadataV2) GetTLFReaderKeyBundleID() TLFReaderKeyBundleID
GetTLFReaderKeyBundleID implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetTLFWriterKeyBundleID ¶
func (md *BareRootMetadataV2) GetTLFWriterKeyBundleID() TLFWriterKeyBundleID
GetTLFWriterKeyBundleID implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetUnresolvedParticipants ¶
func (md *BareRootMetadataV2) GetUnresolvedParticipants() []keybase1.SocialAssertion
GetUnresolvedParticipants implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) GetUserDevicePublicKeys ¶
func (md *BareRootMetadataV2) GetUserDevicePublicKeys(_ ExtraMetadata) ( writerDeviceKeys, readerDeviceKeys UserDevicePublicKeys, err error)
GetUserDevicePublicKeys 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 kbfscrypto.VerifyingKey) error
IsLastModifiedBy implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsReader ¶
func (md *BareRootMetadataV2) IsReader( user keybase1.UID, deviceKID keybase1.KID, _ ExtraMetadata) 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 kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata) error
IsValidAndSigned implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsValidRekeyRequest ¶
func (md *BareRootMetadataV2) IsValidRekeyRequest( codec kbfscodec.Codec, prevBareMd BareRootMetadata, user keybase1.UID, _, _ ExtraMetadata) (bool, error)
IsValidRekeyRequest implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) IsWriter ¶
func (md *BareRootMetadataV2) IsWriter( user keybase1.UID, deviceKID keybase1.KID, _ ExtraMetadata) 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) KeyGenerationsToUpdate ¶
func (md *BareRootMetadataV2) KeyGenerationsToUpdate() (KeyGen, KeyGen)
KeyGenerationsToUpdate implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) LastModifyingWriter ¶
func (md *BareRootMetadataV2) LastModifyingWriter() keybase1.UID
LastModifyingWriter 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(_ ExtraMetadata) ( tlf.Handle, error)
MakeBareTlfHandle implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) MakeSuccessorCopy ¶
func (md *BareRootMetadataV2) MakeSuccessorCopy( codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata, latestMDVer MetadataVer, tlfCryptKeyGetter func() ([]kbfscrypto.TLFCryptKey, error), isReadableAndWriter bool) ( MutableBareRootMetadata, ExtraMetadata, error)
MakeSuccessorCopy implements the ImmutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) MergedStatus ¶
func (md *BareRootMetadataV2) MergedStatus() MergeStatus
MergedStatus implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) PromoteReaders ¶
func (md *BareRootMetadataV2) PromoteReaders( readersToPromote map[keybase1.UID]bool, _ ExtraMetadata) error
PromoteReaders 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) RevokeRemovedDevices ¶
func (md *BareRootMetadataV2) RevokeRemovedDevices( updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, _ ExtraMetadata) (ServerHalfRemovalInfo, error)
RevokeRemovedDevices 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 *tlf.HandleExtension)
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 *tlf.HandleExtension)
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 tlf.ID)
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) SetWriters ¶
func (md *BareRootMetadataV2) SetWriters(writers []keybase1.UID)
SetWriters implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) SignWriterMetadataInternally ¶
func (md *BareRootMetadataV2) SignWriterMetadataInternally( ctx context.Context, codec kbfscodec.Codec, signer kbfscrypto.Signer) error
SignWriterMetadataInternally implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) StoresHistoricTLFCryptKeys ¶
func (md *BareRootMetadataV2) StoresHistoricTLFCryptKeys() bool
StoresHistoricTLFCryptKeys implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) TlfHandleExtensions ¶
func (md *BareRootMetadataV2) TlfHandleExtensions() ( extensions []tlf.HandleExtension)
TlfHandleExtensions implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) TlfID ¶
func (md *BareRootMetadataV2) TlfID() tlf.ID
TlfID implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) UnrefBytes ¶
func (md *BareRootMetadataV2) UnrefBytes() uint64
UnrefBytes implements the BareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) UpdateKeyBundles ¶
func (md *BareRootMetadataV2) UpdateKeyBundles(crypto cryptoPure, _ ExtraMetadata, updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, ePubKey kbfscrypto.TLFEphemeralPublicKey, ePrivKey kbfscrypto.TLFEphemeralPrivateKey, tlfCryptKeys []kbfscrypto.TLFCryptKey) ( []UserDeviceKeyServerHalves, error)
UpdateKeyBundles implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV2) Version ¶
func (md *BareRootMetadataV2) Version() MetadataVer
Version implements the MutableBareRootMetadata interface for BareRootMetadataV2.
type BareRootMetadataV3 ¶
type BareRootMetadataV3 struct { // The metadata that is only editable by the writer. WriterMetadata WriterMetadataV3 `codec:"wmd"` // 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. Any unresolved social assertions for readers. UnresolvedReaders []keybase1.SocialAssertion `codec:"ur,omitempty"` // Pointer to the reader key bundle for private TLFs. RKeyBundleID TLFReaderKeyBundleID `codec:"rkid,omitempty"` // ConflictInfo is set if there's a conflict for the given folder's // handle after a social assertion resolution. ConflictInfo *tlf.HandleExtension `codec:"ci,omitempty"` // FinalizedInfo is set if there are no more valid writer keys capable // of writing to the given folder. FinalizedInfo *tlf.HandleExtension `codec:"fi,omitempty"` codec.UnknownFieldSetHandler }
BareRootMetadataV3 is the MD that is signed by the reader or writer. Unlike RootMetadata, it contains exactly the serializable metadata.
func MakeInitialBareRootMetadataV3 ¶
MakeInitialBareRootMetadataV3 creates a new BareRootMetadataV3 object with revision MetadataRevisionInitial, and the given TLF ID and handle. Note that if the given ID/handle are private, rekeying must be done separately.
func (*BareRootMetadataV3) AddDiskUsage ¶
func (md *BareRootMetadataV3) AddDiskUsage(diskUsage uint64)
AddDiskUsage implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) AddKeyGeneration ¶
func (md *BareRootMetadataV3) AddKeyGeneration(codec kbfscodec.Codec, crypto cryptoPure, currExtra ExtraMetadata, updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, ePubKey kbfscrypto.TLFEphemeralPublicKey, ePrivKey kbfscrypto.TLFEphemeralPrivateKey, pubKey kbfscrypto.TLFPublicKey, currCryptKey, nextCryptKey kbfscrypto.TLFCryptKey) ( nextExtra ExtraMetadata, serverHalves UserDeviceKeyServerHalves, err error)
AddKeyGeneration implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) AddRefBytes ¶
func (md *BareRootMetadataV3) AddRefBytes(refBytes uint64)
AddRefBytes implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) AddUnrefBytes ¶
func (md *BareRootMetadataV3) AddUnrefBytes(unrefBytes uint64)
AddUnrefBytes implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) BID ¶
func (md *BareRootMetadataV3) BID() BranchID
BID implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) CheckValidSuccessor ¶
func (md *BareRootMetadataV3) CheckValidSuccessor( currID MdID, nextMd BareRootMetadata) error
CheckValidSuccessor implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) CheckValidSuccessorForServer ¶
func (md *BareRootMetadataV3) CheckValidSuccessorForServer( currID MdID, nextMd BareRootMetadata) error
CheckValidSuccessorForServer implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) ClearFinalBit ¶
func (md *BareRootMetadataV3) ClearFinalBit()
ClearFinalBit implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) ClearRekeyBit ¶
func (md *BareRootMetadataV3) ClearRekeyBit()
ClearRekeyBit implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) ClearWriterMetadataCopiedBit ¶
func (md *BareRootMetadataV3) ClearWriterMetadataCopiedBit()
ClearWriterMetadataCopiedBit implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) DeepCopy ¶
func (md *BareRootMetadataV3) DeepCopy( codec kbfscodec.Codec) (MutableBareRootMetadata, error)
DeepCopy implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) DiskUsage ¶
func (md *BareRootMetadataV3) DiskUsage() uint64
DiskUsage implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) FinalizeRekey ¶
func (md *BareRootMetadataV3) FinalizeRekey( crypto cryptoPure, extra ExtraMetadata) error
FinalizeRekey implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetCurrentTLFPublicKey ¶
func (md *BareRootMetadataV3) GetCurrentTLFPublicKey( extra ExtraMetadata) (kbfscrypto.TLFPublicKey, error)
GetCurrentTLFPublicKey implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetHistoricTLFCryptKey ¶
func (md *BareRootMetadataV3) GetHistoricTLFCryptKey(crypto cryptoPure, keyGen KeyGen, currentKey kbfscrypto.TLFCryptKey, extra ExtraMetadata) ( kbfscrypto.TLFCryptKey, error)
GetHistoricTLFCryptKey implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetLastModifyingUser ¶
func (md *BareRootMetadataV3) GetLastModifyingUser() keybase1.UID
GetLastModifyingUser implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetPrevRoot ¶
func (md *BareRootMetadataV3) GetPrevRoot() MdID
GetPrevRoot implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetSerializedPrivateMetadata ¶
func (md *BareRootMetadataV3) GetSerializedPrivateMetadata() []byte
GetSerializedPrivateMetadata implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetSerializedWriterMetadata ¶
func (md *BareRootMetadataV3) GetSerializedWriterMetadata( codec kbfscodec.Codec) ([]byte, error)
GetSerializedWriterMetadata implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetTLFCryptKeyParams ¶
func (md *BareRootMetadataV3) GetTLFCryptKeyParams( keyGen KeyGen, user keybase1.UID, key kbfscrypto.CryptPublicKey, extra ExtraMetadata) ( kbfscrypto.TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, TLFCryptKeyServerHalfID, bool, error)
GetTLFCryptKeyParams implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetTLFReaderKeyBundleID ¶
func (md *BareRootMetadataV3) GetTLFReaderKeyBundleID() TLFReaderKeyBundleID
GetTLFReaderKeyBundleID implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetTLFWriterKeyBundleID ¶
func (md *BareRootMetadataV3) GetTLFWriterKeyBundleID() TLFWriterKeyBundleID
GetTLFWriterKeyBundleID implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetUnresolvedParticipants ¶
func (md *BareRootMetadataV3) GetUnresolvedParticipants() []keybase1.SocialAssertion
GetUnresolvedParticipants implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) GetUserDevicePublicKeys ¶
func (md *BareRootMetadataV3) GetUserDevicePublicKeys(extra ExtraMetadata) ( writerDeviceKeys, readerDeviceKeys UserDevicePublicKeys, err error)
GetUserDevicePublicKeys implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsFinal ¶
func (md *BareRootMetadataV3) IsFinal() bool
IsFinal implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsLastModifiedBy ¶
func (md *BareRootMetadataV3) IsLastModifiedBy( uid keybase1.UID, key kbfscrypto.VerifyingKey) error
IsLastModifiedBy implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsReader ¶
func (md *BareRootMetadataV3) IsReader( user keybase1.UID, deviceKID keybase1.KID, extra ExtraMetadata) bool
IsReader implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsRekeySet ¶
func (md *BareRootMetadataV3) IsRekeySet() bool
IsRekeySet implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsUnmergedSet ¶
func (md *BareRootMetadataV3) IsUnmergedSet() bool
IsUnmergedSet implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsValidAndSigned ¶
func (md *BareRootMetadataV3) IsValidAndSigned( codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata) error
IsValidAndSigned implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsValidRekeyRequest ¶
func (md *BareRootMetadataV3) IsValidRekeyRequest( codec kbfscodec.Codec, prevBareMd BareRootMetadata, user keybase1.UID, prevExtra, extra ExtraMetadata) ( bool, error)
IsValidRekeyRequest implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsWriter ¶
func (md *BareRootMetadataV3) IsWriter( user keybase1.UID, deviceKID keybase1.KID, extra ExtraMetadata) bool
IsWriter implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) IsWriterMetadataCopiedSet ¶
func (md *BareRootMetadataV3) IsWriterMetadataCopiedSet() bool
IsWriterMetadataCopiedSet implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) KeyGenerationsToUpdate ¶
func (md *BareRootMetadataV3) KeyGenerationsToUpdate() (KeyGen, KeyGen)
KeyGenerationsToUpdate implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) LastModifyingWriter ¶
func (md *BareRootMetadataV3) LastModifyingWriter() keybase1.UID
LastModifyingWriter implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) LatestKeyGeneration ¶
func (md *BareRootMetadataV3) LatestKeyGeneration() KeyGen
LatestKeyGeneration implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) MakeBareTlfHandle ¶
func (md *BareRootMetadataV3) MakeBareTlfHandle(extra ExtraMetadata) ( tlf.Handle, error)
MakeBareTlfHandle implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) MakeSuccessorCopy ¶
func (md *BareRootMetadataV3) MakeSuccessorCopy( codec kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata, _ MetadataVer, _ func() ([]kbfscrypto.TLFCryptKey, error), isReadableAndWriter bool) ( MutableBareRootMetadata, ExtraMetadata, error)
MakeSuccessorCopy implements the ImmutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) MergedStatus ¶
func (md *BareRootMetadataV3) MergedStatus() MergeStatus
MergedStatus implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) PromoteReaders ¶
func (md *BareRootMetadataV3) PromoteReaders( readersToPromote map[keybase1.UID]bool, extra ExtraMetadata) error
PromoteReaders implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) RefBytes ¶
func (md *BareRootMetadataV3) RefBytes() uint64
RefBytes implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) RevisionNumber ¶
func (md *BareRootMetadataV3) RevisionNumber() MetadataRevision
RevisionNumber implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) RevokeRemovedDevices ¶
func (md *BareRootMetadataV3) RevokeRemovedDevices( updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, extra ExtraMetadata) (ServerHalfRemovalInfo, error)
RevokeRemovedDevices implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetBranchID ¶
func (md *BareRootMetadataV3) SetBranchID(bid BranchID)
SetBranchID implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetConflictInfo ¶
func (md *BareRootMetadataV3) SetConflictInfo(ci *tlf.HandleExtension)
SetConflictInfo implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetDiskUsage ¶
func (md *BareRootMetadataV3) SetDiskUsage(diskUsage uint64)
SetDiskUsage implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetFinalBit ¶
func (md *BareRootMetadataV3) SetFinalBit()
SetFinalBit implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetFinalizedInfo ¶
func (md *BareRootMetadataV3) SetFinalizedInfo(fi *tlf.HandleExtension)
SetFinalizedInfo implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetLastModifyingUser ¶
func (md *BareRootMetadataV3) SetLastModifyingUser(user keybase1.UID)
SetLastModifyingUser implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetLastModifyingWriter ¶
func (md *BareRootMetadataV3) SetLastModifyingWriter(user keybase1.UID)
SetLastModifyingWriter implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetPrevRoot ¶
func (md *BareRootMetadataV3) SetPrevRoot(mdID MdID)
SetPrevRoot implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetRefBytes ¶
func (md *BareRootMetadataV3) SetRefBytes(refBytes uint64)
SetRefBytes implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetRekeyBit ¶
func (md *BareRootMetadataV3) SetRekeyBit()
SetRekeyBit implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetRevision ¶
func (md *BareRootMetadataV3) SetRevision(revision MetadataRevision)
SetRevision implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetSerializedPrivateMetadata ¶
func (md *BareRootMetadataV3) SetSerializedPrivateMetadata(spmd []byte)
SetSerializedPrivateMetadata implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetTlfID ¶
func (md *BareRootMetadataV3) SetTlfID(tlf tlf.ID)
SetTlfID implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetUnmerged ¶
func (md *BareRootMetadataV3) SetUnmerged()
SetUnmerged implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetUnrefBytes ¶
func (md *BareRootMetadataV3) SetUnrefBytes(unrefBytes uint64)
SetUnrefBytes implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetUnresolvedReaders ¶
func (md *BareRootMetadataV3) SetUnresolvedReaders(readers []keybase1.SocialAssertion)
SetUnresolvedReaders implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetUnresolvedWriters ¶
func (md *BareRootMetadataV3) SetUnresolvedWriters(writers []keybase1.SocialAssertion)
SetUnresolvedWriters implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetWriterMetadataCopiedBit ¶
func (md *BareRootMetadataV3) SetWriterMetadataCopiedBit()
SetWriterMetadataCopiedBit implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SetWriters ¶
func (md *BareRootMetadataV3) SetWriters(writers []keybase1.UID)
SetWriters implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) SignWriterMetadataInternally ¶
func (md *BareRootMetadataV3) SignWriterMetadataInternally( ctx context.Context, codec kbfscodec.Codec, signer kbfscrypto.Signer) error
SignWriterMetadataInternally implements the MutableBareRootMetadata interface for BareRootMetadataV2.
func (*BareRootMetadataV3) StoresHistoricTLFCryptKeys ¶
func (md *BareRootMetadataV3) StoresHistoricTLFCryptKeys() bool
StoresHistoricTLFCryptKeys implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) TlfHandleExtensions ¶
func (md *BareRootMetadataV3) TlfHandleExtensions() ( extensions []tlf.HandleExtension)
TlfHandleExtensions implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) TlfID ¶
func (md *BareRootMetadataV3) TlfID() tlf.ID
TlfID implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) UnrefBytes ¶
func (md *BareRootMetadataV3) UnrefBytes() uint64
UnrefBytes implements the BareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) UpdateKeyBundles ¶
func (md *BareRootMetadataV3) UpdateKeyBundles(crypto cryptoPure, extra ExtraMetadata, updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, ePubKey kbfscrypto.TLFEphemeralPublicKey, ePrivKey kbfscrypto.TLFEphemeralPrivateKey, tlfCryptKeys []kbfscrypto.TLFCryptKey) ( []UserDeviceKeyServerHalves, error)
UpdateKeyBundles implements the MutableBareRootMetadata interface for BareRootMetadataV3.
func (*BareRootMetadataV3) Version ¶
func (md *BareRootMetadataV3) Version() MetadataVer
Version implements the MutableBareRootMetadata interface for BareRootMetadataV3.
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) // NewEmpty returns a new block of the same type as this block NewEmpty() Block // Set sets this block to the same value as the passed-in block Set(other Block) // ToCommonBlock retrieves this block as a *CommonBlock. ToCommonBlock() *CommonBlock // contains filtered or unexported methods }
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 { BlockCacheSimple // 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 tlf.ID, block *FileBlock) (BlockPointer, 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 tlf.ID) 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 kbfsblock.ID) error // DeleteKnownPtr removes the cached ID for the given file // block. It does not remove the block itself. DeleteKnownPtr(tlf tlf.ID, block *FileBlock) error // GetWithPrefetch retrieves a block from the cache, along with whether or // not it has triggered a prefetch. GetWithPrefetch(ptr BlockPointer) ( block Block, hasPrefetched bool, lifetime BlockCacheLifetime, err error) // PutWithPrefetch puts a block into the cache, along with whether or not // it has triggered a prefetch. PutWithPrefetch(ptr BlockPointer, tlf tlf.ID, block Block, lifetime BlockCacheLifetime, hasPrefetched bool) error // SetCleanBytesCapacity atomically sets clean bytes capacity for block // cache. SetCleanBytesCapacity(capacity uint64) // GetCleanBytesCapacity atomically gets clean bytes capacity for block // cache. GetCleanBytesCapacity() (capacity uint64) }
BlockCache specifies the interface of BlockCacheSimple, and also more advanced and internal methods.
type BlockCacheLifetime ¶
type BlockCacheLifetime int
BlockCacheLifetime denotes the lifetime of an entry in BlockCache.
const ( // NoCacheEntry means that the entry will not be cached. NoCacheEntry BlockCacheLifetime = iota // TransientEntry means that the cache entry may be evicted at // any time. TransientEntry // PermanentEntry means that the cache entry must remain until // explicitly removed from the cache. PermanentEntry )
type BlockCacheSimple ¶
type BlockCacheSimple interface { // Get gets the block associated with the given block ID. Get(ptr BlockPointer) (Block, 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 tlf.ID, block Block, lifetime BlockCacheLifetime) error }
BlockCacheSimple gets and puts plaintext dir blocks and file blocks into a cache. These blocks are immutable and identified by their content hash.
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(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 tlf.ID, block *FileBlock) ( BlockPointer, error)
CheckForKnownPtr implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) DeleteKnownPtr ¶
func (b *BlockCacheStandard) DeleteKnownPtr(tlf tlf.ID, block *FileBlock) error
DeleteKnownPtr implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) DeletePermanent ¶
func (b *BlockCacheStandard) DeletePermanent(id kbfsblock.ID) error
DeletePermanent implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) DeleteTransient ¶
func (b *BlockCacheStandard) DeleteTransient( ptr BlockPointer, tlf tlf.ID) 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) GetCleanBytesCapacity ¶
func (b *BlockCacheStandard) GetCleanBytesCapacity() (capacity uint64)
GetCleanBytesCapacity implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) GetWithPrefetch ¶
func (b *BlockCacheStandard) GetWithPrefetch(ptr BlockPointer) ( Block, bool, BlockCacheLifetime, error)
GetWithPrefetch implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) Put ¶
func (b *BlockCacheStandard) Put( ptr BlockPointer, tlf tlf.ID, block Block, lifetime BlockCacheLifetime) error
Put implements the BlockCache interface for BlockCacheStandard.
func (*BlockCacheStandard) PutWithPrefetch ¶
func (b *BlockCacheStandard) PutWithPrefetch( ptr BlockPointer, tlf tlf.ID, block Block, lifetime BlockCacheLifetime, hasPrefetched bool) (err error)
PutWithPrefetch implements the BlockCache interface for BlockCacheStandard. This method is idempotent for a given ptr, but that invariant is not currently goroutine-safe, and it does not hold if a block size changes between Puts. That is, we assume that a cached block associated with a given pointer will never change its size, even when it gets Put into the cache again.
func (*BlockCacheStandard) SetCleanBytesCapacity ¶
func (b *BlockCacheStandard) SetCleanBytesCapacity(capacity uint64)
SetCleanBytesCapacity 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 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 BlockDirectType ¶
type BlockDirectType int
BlockDirectType indicates to what kind of block (direct or indirect) a BlockPointer points.
const ( // UnknownDirectType indicates an old block that was written // before we started labeling pointers. UnknownDirectType BlockDirectType = 0 // DirectBlock indicates the pointed-to block has no indirect // pointers. DirectBlock BlockDirectType = 1 // IndirectBlock indicates the pointed-to block has indirect // pointers. IndirectBlock BlockDirectType = 2 )
func (BlockDirectType) String ¶
func (bdt BlockDirectType) String() string
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. cacheLifetime controls the behavior of the // write-through cache once a Get completes. Get(ctx context.Context, kmd KeyMetadata, blockPtr BlockPointer, block Block, cacheLifetime BlockCacheLifetime) 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 kbfsblock.ID, plainSize int, readyBlockData ReadyBlockData, err 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 tlf.ID, ptrs []BlockPointer) ( liveCounts map[kbfsblock.ID]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 tlf.ID, ptrs []BlockPointer) error // TogglePrefetcher activates or deactivates the prefetcher. TogglePrefetcher(ctx context.Context, enable bool) error // Prefetcher retrieves this BlockOps' Prefetcher. Prefetcher() Prefetcher // Shutdown shuts down all the workers performing Get operations Shutdown() }
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.
type BlockOpsStandard ¶
type BlockOpsStandard struct {
// contains filtered or unexported fields
}
BlockOpsStandard implements the BlockOps interface by relaying requests to the block server.
func NewBlockOpsStandard ¶
func NewBlockOpsStandard(config blockOpsConfig, queueSize int) *BlockOpsStandard
NewBlockOpsStandard creates a new BlockOpsStandard
func (*BlockOpsStandard) Archive ¶
func (b *BlockOpsStandard) Archive(ctx context.Context, tlfID tlf.ID, ptrs []BlockPointer) error
Archive implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) Delete ¶
func (b *BlockOpsStandard) Delete(ctx context.Context, tlfID tlf.ID, ptrs []BlockPointer) (liveCounts map[kbfsblock.ID]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, lifetime BlockCacheLifetime) error
Get implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) Prefetcher ¶
func (b *BlockOpsStandard) Prefetcher() Prefetcher
Prefetcher implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) Ready ¶
func (b *BlockOpsStandard) Ready(ctx context.Context, kmd KeyMetadata, block Block) (id kbfsblock.ID, plainSize int, readyBlockData ReadyBlockData, err error)
Ready implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) Shutdown ¶
func (b *BlockOpsStandard) Shutdown()
Shutdown implements the BlockOps interface for BlockOpsStandard.
func (*BlockOpsStandard) TogglePrefetcher ¶
func (b *BlockOpsStandard) TogglePrefetcher(ctx context.Context, enable bool) error
TogglePrefetcher implements the BlockOps interface for BlockOpsStandard.
type BlockPointer ¶
type BlockPointer struct { ID kbfsblock.ID `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 DirectType BlockDirectType `codec:"t,omitempty"` // the type (direct, indirect, or unknown [if omitted]) of the pointed-to block kbfsblock.Context }
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) Ref ¶
func (p BlockPointer) Ref() BlockRef
Ref returns the BlockRef equivalent of this pointer.
func (BlockPointer) String ¶
func (p BlockPointer) String() string
type BlockRef ¶
BlockRef is a block ID/ref nonce pair, which defines a unique reference to a block.
type BlockServer ¶
type BlockServer interface { // 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 tlf.ID, id kbfsblock.ID, context kbfsblock.Context) ( []byte, kbfscrypto.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 kbfsblock.RefNonce // 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 tlf.ID, id kbfsblock.ID, context kbfsblock.Context, buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf) error // AddBlockReference adds a new reference to the given block, // defined by the given context (which should contain a // non-zero kbfsblock.RefNonce). (Contexts with a // kbfsblock.RefNonce 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 tlf.ID, id kbfsblock.ID, context kbfsblock.Context) 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 tlf.ID, contexts kbfsblock.ContextMap) (liveCounts map[kbfsblock.ID]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 tlf.ID, contexts kbfsblock.ContextMap) error // IsUnflushed returns whether a given block is being queued // locally for later flushing to another block server. IsUnflushed(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID) (bool, error) // Shutdown is called to shutdown a BlockServer connection. Shutdown() // GetUserQuotaInfo returns the quota for the user. GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error) // contains filtered or unexported methods }
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.
func MakeTestBlockServerOrBust ¶
func MakeTestBlockServerOrBust(t logger.TestLogBackend, codec kbfscodec.Codec, signer kbfscrypto.Signer, cig currentInfoGetter, rpcLogFactory *libkb.RPCLogFactory, log logger.Logger) BlockServer
MakeTestBlockServerOrBust makes a block server from the given arguments and environment variables.
type BlockServerDisk ¶
type BlockServerDisk struct {
// contains filtered or unexported fields
}
BlockServerDisk implements the BlockServer interface by just storing blocks in a local disk store.
func NewBlockServerDir ¶
NewBlockServerDir constructs a new BlockServerDisk that stores its data in the given directory.
func NewBlockServerTempDir ¶
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 tlf.ID, id kbfsblock.ID, context kbfsblock.Context) error
AddBlockReference implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) ArchiveBlockReferences ¶
func (b *BlockServerDisk) ArchiveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error)
ArchiveBlockReferences implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) Get ¶
func (b *BlockServerDisk) Get(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) ( data []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error)
Get implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) GetUserQuotaInfo ¶
func (b *BlockServerDisk) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error)
GetUserQuotaInfo implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) IsUnflushed ¶
func (b *BlockServerDisk) IsUnflushed(ctx context.Context, tlfID tlf.ID, _ kbfsblock.ID) (bool, error)
IsUnflushed implements the BlockServer interface for BlockServerDisk.
func (*BlockServerDisk) Put ¶
func (b *BlockServerDisk) Put(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context, buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf) (err 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 tlf.ID, contexts kbfsblock.ContextMap) ( liveCounts map[kbfsblock.ID]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 tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (err error)
AddBlockReference implements the BlockServer interface for BlockServerMeasured.
func (BlockServerMeasured) ArchiveBlockReferences ¶
func (b BlockServerMeasured) ArchiveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error)
ArchiveBlockReferences implements the BlockServer interface for BlockServerRemote
func (BlockServerMeasured) Get ¶
func (b BlockServerMeasured) Get(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) ( buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error)
Get implements the BlockServer interface for BlockServerMeasured.
func (BlockServerMeasured) GetUserQuotaInfo ¶
func (b BlockServerMeasured) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error)
GetUserQuotaInfo implements the BlockServer interface for BlockServerMeasured
func (BlockServerMeasured) IsUnflushed ¶
func (b BlockServerMeasured) IsUnflushed(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID) (isUnflushed bool, err error)
IsUnflushed implements the BlockServer interface for BlockServerMeasured.
func (BlockServerMeasured) Put ¶
func (b BlockServerMeasured) Put(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context, buf []byte, serverHalf kbfscrypto.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 tlf.ID, contexts kbfsblock.ContextMap) ( liveCounts map[kbfsblock.ID]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(log logger.Logger) *BlockServerMemory
NewBlockServerMemory constructs a new BlockServerMemory that stores its data in memory.
func (*BlockServerMemory) AddBlockReference ¶
func (b *BlockServerMemory) AddBlockReference(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (err error)
AddBlockReference implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) ArchiveBlockReferences ¶
func (b *BlockServerMemory) ArchiveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error)
ArchiveBlockReferences implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) Get ¶
func (b *BlockServerMemory) Get(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) ( data []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error)
Get implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) GetUserQuotaInfo ¶
func (b *BlockServerMemory) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error)
GetUserQuotaInfo implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) IsUnflushed ¶
func (b *BlockServerMemory) IsUnflushed(ctx context.Context, tlfID tlf.ID, _ kbfsblock.ID) (bool, error)
IsUnflushed implements the BlockServer interface for BlockServerMemory.
func (*BlockServerMemory) Put ¶
func (b *BlockServerMemory) Put(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context, buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf) (err 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 tlf.ID, contexts kbfsblock.ContextMap) ( liveCounts map[kbfsblock.ID]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(codec kbfscodec.Codec, signer kbfscrypto.Signer, cig currentInfoGetter, log logger.Logger, blkSrvAddr string, rpcLogFactory *libkb.RPCLogFactory) *BlockServerRemote
NewBlockServerRemote constructs a new BlockServerRemote for the given address.
func (*BlockServerRemote) AddBlockReference ¶
func (b *BlockServerRemote) AddBlockReference(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) (err error)
AddBlockReference implements the BlockServer interface for BlockServerRemote
func (*BlockServerRemote) ArchiveBlockReferences ¶
func (b *BlockServerRemote) ArchiveBlockReferences(ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error)
ArchiveBlockReferences implements the BlockServer interface for BlockServerRemote
func (*BlockServerRemote) Get ¶
func (b *BlockServerRemote) Get(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context) ( buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error)
Get implements the BlockServer interface for BlockServerRemote.
func (*BlockServerRemote) GetUserQuotaInfo ¶
func (b *BlockServerRemote) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.UserQuotaInfo, err error)
GetUserQuotaInfo implements the BlockServer interface for BlockServerRemote
func (*BlockServerRemote) IsUnflushed ¶
func (b *BlockServerRemote) IsUnflushed( _ context.Context, _ tlf.ID, _ kbfsblock.ID) ( bool, error)
IsUnflushed implements the BlockServer interface for BlockServerRemote.
func (*BlockServerRemote) Put ¶
func (b *BlockServerRemote) Put(ctx context.Context, tlfID tlf.ID, id kbfsblock.ID, context kbfsblock.Context, buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf) (err 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 tlf.ID, contexts kbfsblock.ContextMap) (liveCounts map[kbfsblock.ID]int, err error)
RemoveBlockReferences implements the BlockServer interface for BlockServerRemote
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 // MaxPtrsPerBlock describes the number of indirect pointers we // can fit into one indirect block. MaxPtrsPerBlock() int // 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 kbfscodec.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) MaxPtrsPerBlock ¶
func (b *BlockSplitterSimple) MaxPtrsPerBlock() int
MaxPtrsPerBlock 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 CoalescingContext ¶
CoalescingContext allows many contexts to be treated as one. It waits on all its contexts' Context.Done() channels, and when all of them have returned, this CoalescingContext is canceled. At any point, a context can be added to the list, and will subsequently also be part of the wait condition. TODO: add timeout channel in case there is a goroutine leak.
func NewCoalescingContext ¶
func NewCoalescingContext(parent context.Context) (*CoalescingContext, context.CancelFunc)
NewCoalescingContext creates a new CoalescingContext. The context _must_ be canceled to avoid a goroutine leak.
func (*CoalescingContext) AddContext ¶
func (ctx *CoalescingContext) AddContext(other context.Context) error
AddContext adds a context to the set of contexts that we're waiting on.
func (*CoalescingContext) Deadline ¶
func (ctx *CoalescingContext) Deadline() (time.Time, bool)
Deadline overrides the default parent's Deadline().
func (*CoalescingContext) Done ¶
func (ctx *CoalescingContext) Done() <-chan struct{}
Done returns a channel that is closed when the CoalescingContext is canceled.
func (*CoalescingContext) Err ¶
func (ctx *CoalescingContext) Err() error
Err returns context.Canceled if the CoalescingContext has been canceled, and nil otherwise.
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) DeepCopy ¶
func (cb *CommonBlock) DeepCopy() CommonBlock
DeepCopy copies a CommonBlock without the lock.
func (*CommonBlock) GetEncodedSize ¶
func (cb *CommonBlock) GetEncodedSize() uint32
GetEncodedSize implements the Block interface for CommonBlock
func (*CommonBlock) NewEmpty ¶
func (cb *CommonBlock) NewEmpty() Block
NewEmpty implements the Block interface for CommonBlock.
func (*CommonBlock) Set ¶
func (cb *CommonBlock) Set(other Block)
Set implements the Block interface for CommonBlock.
func (*CommonBlock) SetEncodedSize ¶
func (cb *CommonBlock) SetEncodedSize(size uint32)
SetEncodedSize implements the Block interface for CommonBlock
func (*CommonBlock) ToCommonBlock ¶
func (cb *CommonBlock) ToCommonBlock() *CommonBlock
ToCommonBlock 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 SetKeyBundleCache(KeyBundleCache) KeyBundleCache() KeyBundleCache SetKeyCache(KeyCache) SetBlockCache(BlockCache) DirtyBlockCache() DirtyBlockCache SetDirtyBlockCache(DirtyBlockCache) Crypto() Crypto SetCrypto(Crypto) SetCodec(kbfscodec.Codec) MDOps() MDOps SetMDOps(MDOps) KeyOps() KeyOps SetKeyOps(KeyOps) BlockOps() BlockOps SetBlockOps(BlockOps) MDServer() MDServer SetMDServer(MDServer) 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 SetMetadataVersion(MetadataVer) RekeyQueue() RekeyQueue SetRekeyQueue(RekeyQueue) // ReqsBufSize indicates the number of read or write operations // that can be buffered per folder ReqsBufSize() int // 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 SetRekeyWithPromptWaitTime(time.Duration) // GracePeriod specifies a grace period for which a delayed cancellation // waits before actual cancels the context. This is useful for giving // critical portion of a slow remote operation some extra time to finish as // an effort to avoid conflicting. Example include an O_EXCL Create call // interrupted by ALRM signal actually makes it to the server, while // application assumes not since EINTR is returned. A delayed cancellation // allows us to distinguish between successful cancel (where remote operation // didn't make to server) or failed cancel (where remote operation made to // the server). However, the optimal value of this depends on the network // conditions. A long grace period for really good network condition would // just unnecessarily slow down Ctrl-C. // // TODO: make this adaptive and self-change over time based on network // conditions. DelayedCancellationGracePeriod() time.Duration SetDelayedCancellationGracePeriod(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 // QuotaReclamationMinHeadAge indicates the minimum age of the // most recently merged MD update before we can run reclamation, // to avoid conflicting with a currently active writer. QuotaReclamationMinHeadAge() time.Duration // ResetCaches clears and re-initializes all data and key caches. ResetCaches() // 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(context.Context) error // CheckStateOnShutdown tells the caller whether or not it is safe // to check the state of the system on shutdown. CheckStateOnShutdown() bool // contains filtered or unexported methods }
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. Journaling will not be enabled in the returned Config, regardless of the journal status in `config`.
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(loggerFn func(module string) logger.Logger) *ConfigLocal
NewConfigLocal constructs a new ConfigLocal with some default components that don't depend on a logger. The caller will have to fill in the rest.
TODO: Now that NewConfigLocal takes loggerFn, add more default components.
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() kbfscodec.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) DelayedCancellationGracePeriod ¶
func (c *ConfigLocal) DelayedCancellationGracePeriod() time.Duration
DelayedCancellationGracePeriod 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) EnableJournaling ¶
func (c *ConfigLocal) EnableJournaling( ctx context.Context, journalRoot string, bws TLFJournalBackgroundWorkStatus) error
EnableJournaling creates a JournalServer and attaches it to this config. journalRoot must be non-empty. Errors returned are non-fatal.
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) KeyBundleCache ¶
func (c *ConfigLocal) KeyBundleCache() KeyBundleCache
KeyBundleCache 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) 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) QuotaReclamationMinHeadAge ¶
func (c *ConfigLocal) QuotaReclamationMinHeadAge() time.Duration
QuotaReclamationMinHeadAge 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 kbfscodec.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) SetDelayedCancellationGracePeriod ¶
func (c *ConfigLocal) SetDelayedCancellationGracePeriod(d time.Duration)
SetDelayedCancellationGracePeriod 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) SetKeyBundleCache ¶
func (c *ConfigLocal) SetKeyBundleCache(k KeyBundleCache)
SetKeyBundleCache 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) 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) SetMetadataVersion ¶
func (c *ConfigLocal) SetMetadataVersion(mdVer MetadataVer)
SetMetadataVersion 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) SetRekeyWithPromptWaitTime ¶
func (c *ConfigLocal) SetRekeyWithPromptWaitTime(d time.Duration)
SetRekeyWithPromptWaitTime 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(ctx context.Context) 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(ctx context.Context, op op, original string) ( string, error) }
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) BeginNewBranch ¶
func (cr *ConflictResolver) BeginNewBranch()
BeginNewBranch resets any internal state to be ready to accept resolutions from a new branch.
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. baseCtx must have a cancellation delayer.
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 GetDataDir() string ConfigureSocketInfo() (err error) GetSocket(clearError bool) (net.Conn, rpc.Transporter, bool, error) NewRPCLogFactory() *libkb.RPCLogFactory }
Context defines the environment for this package
type ContextAlreadyHasCancellationDelayerError ¶
type ContextAlreadyHasCancellationDelayerError struct{}
ContextAlreadyHasCancellationDelayerError is returned when NewContextWithCancellationDelayer is called for the second time on the same ctx, which is not supported yet.
func (ContextAlreadyHasCancellationDelayerError) Error ¶
func (e ContextAlreadyHasCancellationDelayerError) Error() string
type Crypto ¶
type Crypto interface { // Duplicate kbfscrypto.Signer here to work around gomock's // limitations. Sign(context.Context, []byte) (kbfscrypto.SignatureInfo, error) SignForKBFS(context.Context, []byte) (kbfscrypto.SignatureInfo, error) SignToString(context.Context, []byte) (string, error) // DecryptTLFCryptKeyClientHalf decrypts a // kbfscrypto.TLFCryptKeyClientHalf using the current device's // private key and the TLF's ephemeral public key. DecryptTLFCryptKeyClientHalf(ctx context.Context, publicKey kbfscrypto.TLFEphemeralPublicKey, encryptedClientHalf EncryptedTLFCryptKeyClientHalf) ( kbfscrypto.TLFCryptKeyClientHalf, error) // DecryptTLFCryptKeyClientHalfAny decrypts one of the // kbfscrypto.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) ( kbfscrypto.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(codec kbfscodec.Codec, 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 kbfscrypto.TLFEphemeralPublicKey, encryptedClientHalf EncryptedTLFCryptKeyClientHalf) ( clientHalf kbfscrypto.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 kbfscrypto.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 kbfscrypto.SignatureInfo, err error)
Sign implements the Crypto interface for CryptoClient.
func (*CryptoClient) SignForKBFS ¶
func (c *CryptoClient) SignForKBFS(ctx context.Context, msg []byte) ( sigInfo kbfscrypto.SignatureInfo, err error)
SignForKBFS implements the Crypto interface for CryptoClient.
func (*CryptoClient) SignToString ¶
SignToString implements the Crypto interface for CryptoClient.
type CryptoClientRPC ¶
type CryptoClientRPC struct { CryptoClient // contains filtered or unexported fields }
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 kbfscodec.Codec) CryptoCommon
MakeCryptoCommon returns a default CryptoCommon object.
func (CryptoCommon) DecryptBlock ¶
func (c CryptoCommon) DecryptBlock( encryptedBlock EncryptedBlock, key kbfscrypto.BlockCryptKey, block Block) error
DecryptBlock implements the Crypto interface for CryptoCommon.
func (CryptoCommon) DecryptMerkleLeaf ¶
func (c CryptoCommon) DecryptMerkleLeaf(encryptedLeaf EncryptedMerkleLeaf, privKey kbfscrypto.TLFPrivateKey, nonce *[24]byte, ePubKey kbfscrypto.TLFEphemeralPublicKey) (*MerkleLeaf, error)
DecryptMerkleLeaf decrypts a Merkle leaf node with the kbfscrypto.TLFPrivateKey.
func (CryptoCommon) DecryptPrivateMetadata ¶
func (c CryptoCommon) DecryptPrivateMetadata( encryptedPmd EncryptedPrivateMetadata, key kbfscrypto.TLFCryptKey) ( PrivateMetadata, error)
DecryptPrivateMetadata implements the Crypto interface for CryptoCommon.
func (CryptoCommon) DecryptTLFCryptKeys ¶
func (c CryptoCommon) DecryptTLFCryptKeys( encKeys EncryptedTLFCryptKeys, key kbfscrypto.TLFCryptKey) ( []kbfscrypto.TLFCryptKey, error)
DecryptTLFCryptKeys implements the Crypto interface for CryptoCommon.
func (CryptoCommon) EncryptBlock ¶
func (c CryptoCommon) EncryptBlock(block Block, key kbfscrypto.BlockCryptKey) ( plainSize int, encryptedBlock EncryptedBlock, err error)
EncryptBlock implements the Crypto interface for CryptoCommon.
func (CryptoCommon) EncryptMerkleLeaf ¶
func (c CryptoCommon) EncryptMerkleLeaf(leaf MerkleLeaf, pubKey kbfscrypto.TLFPublicKey, nonce *[24]byte, ePrivKey kbfscrypto.TLFEphemeralPrivateKey) ( EncryptedMerkleLeaf, error)
EncryptMerkleLeaf encrypts a Merkle leaf node with the kbfscrypto.TLFPublicKey.
func (CryptoCommon) EncryptPrivateMetadata ¶
func (c CryptoCommon) EncryptPrivateMetadata( pmd PrivateMetadata, key kbfscrypto.TLFCryptKey) ( encryptedPmd EncryptedPrivateMetadata, err error)
EncryptPrivateMetadata implements the Crypto interface for CryptoCommon.
func (CryptoCommon) EncryptTLFCryptKeyClientHalf ¶
func (c CryptoCommon) EncryptTLFCryptKeyClientHalf( privateKey kbfscrypto.TLFEphemeralPrivateKey, publicKey kbfscrypto.CryptPublicKey, clientHalf kbfscrypto.TLFCryptKeyClientHalf) ( encryptedClientHalf EncryptedTLFCryptKeyClientHalf, err error)
EncryptTLFCryptKeyClientHalf implements the Crypto interface for CryptoCommon.
func (CryptoCommon) EncryptTLFCryptKeys ¶
func (c CryptoCommon) EncryptTLFCryptKeys( oldKeys []kbfscrypto.TLFCryptKey, key kbfscrypto.TLFCryptKey) ( encryptedKeys EncryptedTLFCryptKeys, err error)
EncryptTLFCryptKeys implements the Crypto interface for CryptoCommon.
func (CryptoCommon) GetTLFCryptKeyServerHalfID ¶
func (c CryptoCommon) GetTLFCryptKeyServerHalfID( user keybase1.UID, devicePubKey kbfscrypto.CryptPublicKey, serverHalf kbfscrypto.TLFCryptKeyServerHalf) ( TLFCryptKeyServerHalfID, error)
GetTLFCryptKeyServerHalfID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeBlockRefNonce ¶
func (c CryptoCommon) MakeBlockRefNonce() (nonce kbfsblock.RefNonce, 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) MakeRandomBlockCryptKeyServerHalf ¶
func (c CryptoCommon) MakeRandomBlockCryptKeyServerHalf() ( kbfscrypto.BlockCryptKeyServerHalf, 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 kbfscrypto.TLFCryptKeyServerHalf, err error)
MakeRandomTLFCryptKeyServerHalf implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeRandomTLFEphemeralKeys ¶
func (c CryptoCommon) MakeRandomTLFEphemeralKeys() ( kbfscrypto.TLFEphemeralPublicKey, kbfscrypto.TLFEphemeralPrivateKey, error)
MakeRandomTLFEphemeralKeys implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeRandomTLFKeys ¶
func (c CryptoCommon) MakeRandomTLFKeys() (kbfscrypto.TLFPublicKey, kbfscrypto.TLFPrivateKey, kbfscrypto.TLFCryptKey, error)
MakeRandomTLFKeys implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeRandomTlfID ¶
func (c CryptoCommon) MakeRandomTlfID(isPublic bool) (tlf.ID, error)
MakeRandomTlfID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeTLFReaderKeyBundleID ¶
func (c CryptoCommon) MakeTLFReaderKeyBundleID(rkb TLFReaderKeyBundleV3) ( TLFReaderKeyBundleID, error)
MakeTLFReaderKeyBundleID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeTLFWriterKeyBundleID ¶
func (c CryptoCommon) MakeTLFWriterKeyBundleID(wkb TLFWriterKeyBundleV3) ( TLFWriterKeyBundleID, error)
MakeTLFWriterKeyBundleID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) MakeTemporaryBlockID ¶
func (c CryptoCommon) MakeTemporaryBlockID() (kbfsblock.ID, error)
MakeTemporaryBlockID implements the Crypto interface for CryptoCommon.
func (CryptoCommon) VerifyTLFCryptKeyServerHalfID ¶
func (c CryptoCommon) VerifyTLFCryptKeyServerHalfID( serverHalfID TLFCryptKeyServerHalfID, user keybase1.UID, deviceKID keybase1.KID, serverHalf kbfscrypto.TLFCryptKeyServerHalf) error
VerifyTLFCryptKeyServerHalfID implements the Crypto interface for CryptoCommon.
type CryptoLocal ¶
type CryptoLocal struct { CryptoCommon kbfscrypto.SigningKeySigner // 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(codec kbfscodec.Codec, signingKey kbfscrypto.SigningKey, cryptPrivateKey kbfscrypto.CryptPrivateKey) CryptoLocal
NewCryptoLocal constructs a new CryptoLocal instance with the given signing key.
func (CryptoLocal) DecryptTLFCryptKeyClientHalf ¶
func (c CryptoLocal) DecryptTLFCryptKeyClientHalf(ctx context.Context, publicKey kbfscrypto.TLFEphemeralPublicKey, encryptedClientHalf EncryptedTLFCryptKeyClientHalf) ( kbfscrypto.TLFCryptKeyClientHalf, error)
DecryptTLFCryptKeyClientHalf implements the Crypto interface for CryptoLocal.
func (CryptoLocal) DecryptTLFCryptKeyClientHalfAny ¶
func (c CryptoLocal) DecryptTLFCryptKeyClientHalfAny(ctx context.Context, keys []EncryptedTLFCryptKeyClientAndEphemeral, _ bool) ( clientHalf kbfscrypto.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 CtxBackgroundSyncKeyType ¶
type CtxBackgroundSyncKeyType int
CtxBackgroundSyncKeyType is the type for a context background sync key.
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 CtxBackgroundSyncKeyType = iota )
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 CtxCancellationDelayerKeyType ¶
type CtxCancellationDelayerKeyType int
CtxCancellationDelayerKeyType is a type for the context key for using cancellationDelayer
const ( // CtxCancellationDelayerKey is a context key for using cancellationDelayer CtxCancellationDelayerKey CtxCancellationDelayerKeyType = 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 CtxJournalTagKey ¶
type CtxJournalTagKey int
CtxJournalTagKey is the type used for unique context tags within background journal work.
const ( // CtxJournalIDKey is the type of the tag for unique operation IDs // within background journal work. CtxJournalIDKey CtxJournalTagKey = 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 CtxNotReplayableError ¶
type CtxNotReplayableError struct{}
CtxNotReplayableError is returned when NewContextWithReplayFrom is called on a ctx with no replay func.
func (CtxNotReplayableError) Error ¶
func (e CtxNotReplayableError) Error() string
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 CtxReplayFunc ¶
CtxReplayFunc is a function for replaying a series of changes done on a context.
type CtxReplayKeyType ¶
type CtxReplayKeyType int
CtxReplayKeyType is a type for the context key for CtxReplayFunc
const ( // CtxReplayKey is a context key for CtxReplayFunc CtxReplayKey CtxReplayKeyType = iota )
type DataVer ¶
type DataVer int
DataVer is the type of a version for marshalled KBFS data structures.
1) DataVer is a per-block attribute, not per-file. This means that, in theory, an indirect block with DataVer n may point to blocks with DataVers less than, equal to, or greater than n. However, for now, it's guaranteed that an indirect block will never point to blocks with greater versions than itself. (See #3 for details.)
2) DataVer is an external attribute of a block, meaning that it's not stored as part of the block, but computed by the creator (or anyone with the latest kbfs client), and stored only in pointers to the block.
2.5) A file (or, in the future a dir) can in theory have any arbitrary tree structure of blocks. However, we only write files such that all paths to leaves have the same depth.
Currently, in addition to 2.5, we have the following constraints on block tree structures: a) Direct blocks are always v1. b) Indirect blocks of depth 2 (meaning one indirect block pointing to all direct blocks) can be v1 (if it has no holes) or v2 (if it has holes). However, all its indirect pointers will have DataVer 1, by a). c) Indirect blocks of depth 3 must be v3 and must have at least one indirect pointer with an indirect DirectType [although if it holds for one, it should hold for all], although its indirect pointers may have any combination of DataVer 1 or 2, by b). d) Indirect blocks of dept k > 3 must be v3 and must have at least one indirect pointer with an indirect DirectType [although if it holds for one, it should hold for all], and all of its indirect pointers must have DataVer 3, by c).
const ( // FirstValidDataVer is the first value that is considered a // valid data version. Note that the nil value is not // considered valid. FirstValidDataVer DataVer = 1 // ChildHolesDataVer is the data version for any indirect block // containing a set of pointers with holes. ChildHolesDataVer DataVer = 2 // AtLeastTwoLevelsOfChildrenDataVer is the data version for // blocks that have multiple levels of indirection below them // (i.e., indirect blocks that point to other indirect blocks). AtLeastTwoLevelsOfChildrenDataVer DataVer = 3 )
func DefaultNewBlockDataVersion ¶
DefaultNewBlockDataVersion returns the default data version for new blocks.
type DeviceKeyInfoMapV2 ¶
type DeviceKeyInfoMapV2 map[keybase1.KID]TLFCryptKeyInfo
DeviceKeyInfoMapV2 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 DeviceKeyInfoMapV3 ¶
type DeviceKeyInfoMapV3 map[kbfscrypto.CryptPublicKey]TLFCryptKeyInfo
DeviceKeyInfoMapV3 is a map from a user devices (identified by the corresponding device CryptPublicKey) to the TLF's symmetric secret key information.
type DeviceKeyServerHalves ¶
type DeviceKeyServerHalves map[kbfscrypto.CryptPublicKey]kbfscrypto.TLFCryptKeyServerHalf
DeviceKeyServerHalves is a map from a user devices (identified by the corresponding device CryptPublicKey) to corresponding key server halves.
type DevicePublicKeys ¶
type DevicePublicKeys map[kbfscrypto.CryptPublicKey]bool
DevicePublicKeys is a set of a user's devices (identified by the corresponding device CryptPublicKey).
func (DevicePublicKeys) Equals ¶
func (dpk DevicePublicKeys) Equals(other DevicePublicKeys) bool
Equals returns whether both sets of keys are equal.
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
func (*DirBlock) ToCommonBlock ¶
func (db *DirBlock) ToCommonBlock() *CommonBlock
ToCommonBlock implements the Block interface for DirBlock.
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(tlfID tlf.ID, ptr BlockPointer, branch BranchName) (Block, error) // Put stores a dirty block currently identified by the // given block pointer and branch name. Put(tlfID tlf.ID, 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(tlfID tlf.ID, 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(tlfID tlf.ID, ptr BlockPointer, branch BranchName) bool // IsAnyDirty returns whether there are any dirty blocks in the // cache. tlfID may be ignored. IsAnyDirty(tlfID tlf.ID) 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, tlfID tlf.ID, 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(tlfID tlf.ID, 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(tlfID tlf.ID, 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(tlfID tlf.ID, 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(tlfID tlf.ID, size int64) // ShouldForceSync returns true if the sync buffer is full enough // to force all callers to sync their data immediately. ShouldForceSync(tlfID tlf.ID) 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.
To avoid keeping the buffer capacity large when network conditions suddenly worsen (say after a laptop sleep when it comes back online on a new, worse network), the capacity is reset back to the minimum if resetBufferCapTime passes without any large syncs. TODO: in the future it might make sense to decrease the buffer capacity, rather than resetting it to the minimum?
func NewDirtyBlockCacheStandard ¶
func NewDirtyBlockCacheStandard(clock Clock, log logger.Logger, minSyncBufCap int64, maxSyncBufCap int64, startSyncBufCap int64) *DirtyBlockCacheStandard
NewDirtyBlockCacheStandard constructs a new BlockCacheStandard instance. 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(_ tlf.ID, size int64)
BlockSyncFinished implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) Delete ¶
func (d *DirtyBlockCacheStandard) Delete(_ tlf.ID, ptr BlockPointer, branch BranchName) error
Delete implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) Get ¶
func (d *DirtyBlockCacheStandard) Get(_ tlf.ID, ptr BlockPointer, branch BranchName) (Block, error)
Get implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) IsAnyDirty ¶
func (d *DirtyBlockCacheStandard) IsAnyDirty(_ tlf.ID) bool
IsAnyDirty implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) IsDirty ¶
func (d *DirtyBlockCacheStandard) IsDirty(_ tlf.ID, ptr BlockPointer, branch BranchName) (isDirty bool)
IsDirty implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) Put ¶
func (d *DirtyBlockCacheStandard) Put(_ tlf.ID, ptr BlockPointer, branch BranchName, block Block) error
Put implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) RequestPermissionToDirty ¶
func (d *DirtyBlockCacheStandard) RequestPermissionToDirty( ctx context.Context, _ tlf.ID, estimatedDirtyBytes int64) ( DirtyPermChan, error)
RequestPermissionToDirty implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) ShouldForceSync ¶
func (d *DirtyBlockCacheStandard) ShouldForceSync(_ tlf.ID) 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(_ tlf.ID, size int64)
SyncFinished implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) UpdateSyncingBytes ¶
func (d *DirtyBlockCacheStandard) UpdateSyncingBytes(_ tlf.ID, size int64)
UpdateSyncingBytes implements the DirtyBlockCache interface for DirtyBlockCacheStandard.
func (*DirtyBlockCacheStandard) UpdateUnsyncedBytes ¶
func (d *DirtyBlockCacheStandard) UpdateUnsyncedBytes(_ tlf.ID, 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 EncryptedBlock ¶
type EncryptedBlock struct {
// contains filtered or unexported fields
}
EncryptedBlock is an encrypted Block.
type EncryptedMerkleLeaf ¶
type EncryptedMerkleLeaf struct { Version EncryptionVer EncryptedData []byte // contains filtered or unexported fields }
EncryptedMerkleLeaf is an encrypted Merkle leaf.
type EncryptedPrivateMetadata ¶
type EncryptedPrivateMetadata struct {
// contains filtered or unexported fields
}
EncryptedPrivateMetadata is an encrypted PrivateMetadata object.
type EncryptedTLFCryptKeyClientAndEphemeral ¶
type EncryptedTLFCryptKeyClientAndEphemeral struct { // PublicKey contains the wrapped Key ID of the public key PubKey kbfscrypto.CryptPublicKey // ClientHalf contains the encrypted client half of the TLF key ClientHalf EncryptedTLFCryptKeyClientHalf // EPubKey contains the ephemeral public key used to encrypt ClientHalf EPubKey kbfscrypto.TLFEphemeralPublicKey }
EncryptedTLFCryptKeyClientAndEphemeral has what's needed to request a client half decryption.
type EncryptedTLFCryptKeyClientHalf ¶
type EncryptedTLFCryptKeyClientHalf struct {
// contains filtered or unexported fields
}
EncryptedTLFCryptKeyClientHalf is an encrypted TLFCryptKeyClientHalf object.
type EncryptedTLFCryptKeys ¶
type EncryptedTLFCryptKeys struct {
// contains filtered or unexported fields
}
EncryptedTLFCryptKeys is an encrypted TLFCryptKey array.
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 )
func (EncryptionVer) String ¶
func (v EncryptionVer) String() string
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 ErrDiskLimitTimeout ¶
type ErrDiskLimitTimeout struct {
// contains filtered or unexported fields
}
ErrDiskLimitTimeout is returned when putBlockData exceeds diskLimitTimeout when trying to acquire bytes to put.
func (ErrDiskLimitTimeout) Error ¶
func (e ErrDiskLimitTimeout) Error() string
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 ExtendedIdentifyAlreadyExists ¶
type ExtendedIdentifyAlreadyExists struct{}
ExtendedIdentifyAlreadyExists is returned when makeExtendedIdentify is called on a context already with extendedIdentify.
func (ExtendedIdentifyAlreadyExists) Error ¶
func (e ExtendedIdentifyAlreadyExists) Error() string
type ExtraMetadata ¶
type ExtraMetadata interface { MetadataVersion() MetadataVer DeepCopy(kbfscodec.Codec) (ExtraMetadata, error) MakeSuccessorCopy(kbfscodec.Codec) (ExtraMetadata, error) }
ExtraMetadata is a per-version blob of extra metadata which may exist outside of the given metadata block, e.g. key bundles for post-v2 metadata.
func FakeInitialRekey ¶
func FakeInitialRekey(md MutableBareRootMetadata, h tlf.Handle, pubKey kbfscrypto.TLFPublicKey) ExtraMetadata
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. pubKey is non-empty only for server-side tests.
type ExtraMetadataV3 ¶
type ExtraMetadataV3 struct {
// contains filtered or unexported fields
}
ExtraMetadataV3 contains references to key bundles stored outside of metadata blocks. This only ever exists in memory and is never serialized itself.
func NewExtraMetadataV3 ¶
func NewExtraMetadataV3( wkb TLFWriterKeyBundleV3, rkb TLFReaderKeyBundleV3, wkbNew, rkbNew bool) *ExtraMetadataV3
NewExtraMetadataV3 creates a new ExtraMetadataV3 given a pair of key bundles
func (ExtraMetadataV3) DeepCopy ¶
func (extra ExtraMetadataV3) DeepCopy(codec kbfscodec.Codec) ( ExtraMetadata, error)
DeepCopy implements the ExtraMetadata interface for ExtraMetadataV3.
func (ExtraMetadataV3) GetReaderKeyBundle ¶
func (extra ExtraMetadataV3) GetReaderKeyBundle() TLFReaderKeyBundleV3
GetReaderKeyBundle returns the contained reader key bundle.
func (ExtraMetadataV3) GetWriterKeyBundle ¶
func (extra ExtraMetadataV3) GetWriterKeyBundle() TLFWriterKeyBundleV3
GetWriterKeyBundle returns the contained writer key bundle.
func (ExtraMetadataV3) MakeSuccessorCopy ¶
func (extra ExtraMetadataV3) MakeSuccessorCopy(codec kbfscodec.Codec) ( ExtraMetadata, error)
MakeSuccessorCopy implements the ExtraMetadata interface for ExtraMetadataV3.
func (ExtraMetadataV3) MetadataVersion ¶
func (extra ExtraMetadataV3) MetadataVersion() MetadataVer
MetadataVersion implements the ExtraMetadata interface for ExtraMetadataV3.
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, which is assumed to have been modified locally.
func (*FileBlock) GetHash ¶
func (fb *FileBlock) GetHash() kbfshash.RawDefaultHash
GetHash returns the hash of this FileBlock. If the hash is nil, it first calculates it.
func (*FileBlock) ToCommonBlock ¶
func (fb *FileBlock) ToCommonBlock() *CommonBlock
ToCommonBlock implements the Block interface for FileBlock.
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 FileTooBigForCRError ¶
type FileTooBigForCRError struct {
// contains filtered or unexported fields
}
FileTooBigForCRError indicates that a file is too big to fit in memory, and CR can't handle it.
func (FileTooBigForCRError) Error ¶
func (e FileTooBigForCRError) Error() string
Error implements the error interface for FileTooBigForCRError.
type FolderBranch ¶
type FolderBranch struct { Tlf tlf.ID 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 BranchID string HeadWriter libkb.NormalizedUsername DiskUsage uint64 RekeyPending bool LatestKeyGeneration KeyGen FolderID string Revision MetadataRevision MDVersion MetadataVer // 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"` PermanentErr string `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 GCOp ¶
type GCOp struct { OpCommon // LatestRev is the most recent MD revision that was // garbage-collected with this operation. // // The codec name overrides the one for RefBlocks in OpCommon, // which GCOp doesn't use. LatestRev MetadataRevision `codec:"r"` }
GCOp is an op that represents garbage-collecting the history of a folder (which may involve unreferencing blocks that previously held operation lists. It may contain unref blocks before it is added to the metadata ops list.
func (*GCOp) SizeExceptUpdates ¶
SizeExceptUpdates implements op.
func (*GCOp) StringWithRefs ¶
StringWithRefs implements the op interface for GCOp.
type ImmutableBareRootMetadata ¶
type ImmutableBareRootMetadata struct { BareRootMetadata // contains filtered or unexported fields }
ImmutableBareRootMetadata is a thin wrapper around a BareRootMetadata and an ExtraMetadata 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.
Note that crypto.MakeMdID() on an ImmutableBareRootMetadata will compute the wrong result, since anonymous fields of interface type are not encoded inline by the codec. Use crypto.MakeMDID(ibrmd.BareRootMetadata) instead.
TODO: Move this to bare_root_metadata.go if it's used in more places.
func MakeImmutableBareRootMetadata ¶
func MakeImmutableBareRootMetadata( rmd BareRootMetadata, extra ExtraMetadata, mdID MdID, localTimestamp time.Time) ImmutableBareRootMetadata
MakeImmutableBareRootMetadata makes a new ImmutableBareRootMetadata from the given BareRootMetadata and its corresponding MdID.
func (ImmutableBareRootMetadata) MakeBareTlfHandleWithExtra ¶
func (ibrmd ImmutableBareRootMetadata) MakeBareTlfHandleWithExtra() ( tlf.Handle, error)
MakeBareTlfHandleWithExtra makes a BareTlfHandle for this ImmutableBareRootMetadata. Should be used only by servers and MDOps.
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, writerVerifyingKey kbfscrypto.VerifyingKey, mdID MdID, localTimestamp time.Time) ImmutableRootMetadata
MakeImmutableRootMetadata makes a new ImmutableRootMetadata from the given RMD and its corresponding MdID.
func (ImmutableRootMetadata) LastModifyingWriterVerifyingKey ¶
func (irmd ImmutableRootMetadata) LastModifyingWriterVerifyingKey() kbfscrypto.VerifyingKey
LastModifyingWriterVerifyingKey returns the VerifyingKey used by the last writer of this MD.
func (ImmutableRootMetadata) LocalTimestamp ¶
func (irmd ImmutableRootMetadata) LocalTimestamp() time.Time
LocalTimestamp returns the timestamp associated with this RootMetadata object.
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. This is here for historical // reasons; a `FileBlock` should be treated as having a `HasHoles` // flag set to true if any of its IPtrs have `Holes` set to true. Holes bool `codec:"h,omitempty"` codec.UnknownFieldSetHandler }
IndirectFilePtr pairs an indirect file block with the start of that block's range of bytes (inclusive)
If `Holes` is true, then this pointer is part of a list of pointers that has non-continuous offsets; that is, the offset of ptr `i` plus the length of the corresponding block contents is less than the offset of ptr `i`+1.
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. Can also // be "memory" for an in-memory test server or // "dir:/path/to/dir" for an on-disk test server. BServerAddr string // If non-empty the host:port of the metadata server. If // empty, a default value is used depending on the run mode. // Can also be "memory" for an in-memory test server or // "dir:/path/to/dir" for an on-disk test server. MDServerAddr string // If non-zero, specifies the capacity (in bytes) of the block cache. If // zero, the capacity is set using getDefaultBlockCacheCapacity(). CleanBlockCacheCapacity uint64 // Fake local user name. LocalUser string // Where to put favorites. Has an effect only when LocalUser // is non-empty, in which case it must be either "memory" or // "dir:/path/to/dir". LocalFavoriteStorage string // TLFValidDuration is the duration that TLFs are valid // before marked for lazy revalidation. TLFValidDuration time.Duration // MetadataVersion is the default version of metadata to use // when creating new metadata. MetadataVersion MetadataVer // LogToFile if true, logs to a default file location. LogToFile bool // LogFileConfig tells us where to log and rotation config. LogFileConfig logger.LogFileConfig // TLFJournalBackgroundWorkStatus is the status to use to // pass into JournalServer.EnableJournaling. Only has an effect when // WriteJournalRoot is non-empty. TLFJournalBackgroundWorkStatus TLFJournalBackgroundWorkStatus // 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 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 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 tlf.ID 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 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.
The maximum number of characters added to the root dir by a journal server journal is 108: 51 for the TLF journal, and 57 for everything else.
/v1/de...-...(53 characters total)...ff(/tlf journal)
func GetJournalServer ¶
func GetJournalServer(config Config) (*JournalServer, error)
GetJournalServer returns the JournalServer tied to a particular config.
func (*JournalServer) DisableAuto ¶
func (j *JournalServer) DisableAuto(ctx context.Context) error
DisableAuto turns off automatic write journal for any newly-accessed TLFs. Existing journaled TLFs need to be disabled manually.
func (*JournalServer) Enable ¶
func (j *JournalServer) Enable(ctx context.Context, tlfID tlf.ID, bws TLFJournalBackgroundWorkStatus) error
Enable turns on the write journal for the given TLF.
func (*JournalServer) EnableAuto ¶
func (j *JournalServer) EnableAuto(ctx context.Context) error
EnableAuto turns on the write journal for all TLFs, even new ones, persistently.
func (*JournalServer) EnableExistingJournals ¶
func (j *JournalServer) EnableExistingJournals( ctx context.Context, currentUID keybase1.UID, currentVerifyingKey kbfscrypto.VerifyingKey, bws TLFJournalBackgroundWorkStatus) (err error)
EnableExistingJournals turns on the write journal for all TLFs for the given (UID, device) tuple (with the device identified by its verifying key) with an existing journal. Any returned error means that the JournalServer remains in the same state as it was before.
Once this is called, this must not be called again until shutdownExistingJournals is called.
func (*JournalServer) JournalStatus ¶
func (j *JournalServer) JournalStatus(tlfID tlf.ID) ( TLFJournalStatus, error)
JournalStatus returns a TLFServerStatus object for the given TLF suitable for diagnostics.
func (*JournalServer) JournalStatusWithPaths ¶
func (j *JournalServer) JournalStatusWithPaths(ctx context.Context, tlfID tlf.ID, cpp chainsPathPopulator) (TLFJournalStatus, error)
JournalStatusWithPaths returns a TLFServerStatus object for the given TLF suitable for diagnostics, including paths for all the unflushed entries.
func (*JournalServer) PauseBackgroundWork ¶
func (j *JournalServer) PauseBackgroundWork(ctx context.Context, tlfID tlf.ID)
PauseBackgroundWork pauses the background work goroutine, if it's not already paused.
func (*JournalServer) ResumeBackgroundWork ¶
func (j *JournalServer) ResumeBackgroundWork(ctx context.Context, tlfID tlf.ID)
ResumeBackgroundWork resumes the background work goroutine, if it's not already resumed.
func (*JournalServer) Status ¶
func (j *JournalServer) Status( ctx context.Context) (JournalServerStatus, []tlf.ID)
Status returns a JournalServerStatus object suitable for diagnostics. It also returns a list of TLF IDs which have journals enabled.
type JournalServerStatus ¶
type JournalServerStatus struct { RootDir string Version int CurrentUID keybase1.UID CurrentVerifyingKey kbfscrypto.VerifyingKey EnableAuto bool JournalCount int // The byte counters below are signed because // os.FileInfo.Size() is signed. StoredBytes int64 UnflushedBytes int64 UnflushedPaths []string }
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 []kbfscrypto.TLFCryptKey, id tlf.ID, err error) // GetTLFID gets the TLF ID for tlfHandle. GetTLFID(ctx context.Context, tlfHandle *TlfHandle) (tlf.ID, 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 tlf.ID) 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) // GetNodeMetadata gets metadata associated with a Node. GetNodeMetadata(ctx context.Context, node Node) (NodeMetadata, error) // Shutdown is called to clean up any resources associated with // this KBFSOps instance. Shutdown(ctx context.Context) error // PushConnectionStatusChange updates the status of a service for // human readable connection status tracking. PushConnectionStatusChange(service string, newStatus error) // PushStatusChange causes Status listeners to be notified via closing // the status channel. PushStatusChange() // ClearPrivateFolderMD clears any cached private folder metadata, // e.g. on a logout. ClearPrivateFolderMD(ctx context.Context) // ForceFastForward forwards the nodes of all folders that have // been previously cleared with `ClearPrivateFolderMD` to their // newest version. It works asynchronously, so no error is // returned. ForceFastForward(ctx context.Context) }
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) ClearPrivateFolderMD ¶
func (fs *KBFSOpsStandard) ClearPrivateFolderMD(ctx context.Context)
ClearPrivateFolderMD 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) ForceFastForward ¶
func (fs *KBFSOpsStandard) ForceFastForward(ctx context.Context)
ForceFastForward 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) GetNodeMetadata ¶
func (fs *KBFSOpsStandard) GetNodeMetadata(ctx context.Context, node Node) ( NodeMetadata, error)
GetNodeMetadata 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 []kbfscrypto.TLFCryptKey, id tlf.ID, err error)
GetTLFCryptKeys implements the KBFSOps interface for KBFSOpsStandard
func (*KBFSOpsStandard) GetTLFID ¶
func (fs *KBFSOpsStandard) GetTLFID(ctx context.Context, tlfHandle *TlfHandle) (id tlf.ID, err error)
GetTLFID 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) PushStatusChange ¶
func (fs *KBFSOpsStandard) PushStatusChange()
PushStatusChange forces a new status be fetched by status listeners.
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) 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(ctx context.Context) 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 { // HasVerifyingKey returns nil if the given user has the given // VerifyingKey, and an error otherwise. HasVerifyingKey(ctx context.Context, uid keybase1.UID, verifyingKey kbfscrypto.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 kbfscrypto.VerifyingKey) error // GetCryptPublicKeys gets all of a user's crypt public keys (including // paper keys). GetCryptPublicKeys(ctx context.Context, uid keybase1.UID) ( []kbfscrypto.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 KeybaseService.
func NewKBPKIClient ¶
func NewKBPKIClient( serviceOwner keybaseServiceOwner, log logger.Logger) *KBPKIClient
NewKBPKIClient returns a new KBPKIClient with the given service.
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 []kbfscrypto.CryptPublicKey, err error)
GetCryptPublicKeys implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) GetCurrentCryptPublicKey ¶
func (k *KBPKIClient) GetCurrentCryptPublicKey(ctx context.Context) ( kbfscrypto.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) ( kbfscrypto.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 kbfscrypto.VerifyingKey) error
HasUnverifiedVerifyingKey implements the KBPKI interface for KBPKIClient.
func (*KBPKIClient) HasVerifyingKey ¶
func (k *KBPKIClient) HasVerifyingKey(ctx context.Context, uid keybase1.UID, verifyingKey kbfscrypto.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 KeyBundleCache ¶
type KeyBundleCache interface { // GetTLFReaderKeyBundle returns the TLFReaderKeyBundleV3 for // the given TLFReaderKeyBundleID, or nil if there is none. GetTLFReaderKeyBundle(tlf.ID, TLFReaderKeyBundleID) (*TLFReaderKeyBundleV3, error) // GetTLFWriterKeyBundle returns the TLFWriterKeyBundleV3 for // the given TLFWriterKeyBundleID, or nil if there is none. GetTLFWriterKeyBundle(tlf.ID, TLFWriterKeyBundleID) (*TLFWriterKeyBundleV3, error) // PutTLFReaderKeyBundle stores the given TLFReaderKeyBundleV3. PutTLFReaderKeyBundle(tlf.ID, TLFReaderKeyBundleID, TLFReaderKeyBundleV3) // PutTLFWriterKeyBundle stores the given TLFWriterKeyBundleV3. PutTLFWriterKeyBundle(tlf.ID, TLFWriterKeyBundleID, TLFWriterKeyBundleV3) }
KeyBundleCache is an interface to a key bundle cache for use with v3 metadata.
type KeyBundleCacheMeasured ¶
type KeyBundleCacheMeasured struct {
// contains filtered or unexported fields
}
KeyBundleCacheMeasured delegates to another KeyBundleCache instance but also keeps track of stats.
func NewKeyBundleCacheMeasured ¶
func NewKeyBundleCacheMeasured(delegate KeyBundleCache, r metrics.Registry) KeyBundleCacheMeasured
NewKeyBundleCacheMeasured creates and returns a new KeyBundleCacheMeasured instance with the given delegate and registry.
func (KeyBundleCacheMeasured) GetTLFReaderKeyBundle ¶
func (b KeyBundleCacheMeasured) GetTLFReaderKeyBundle( tlfID tlf.ID, bundleID TLFReaderKeyBundleID) (rkb *TLFReaderKeyBundleV3, err error)
GetTLFReaderKeyBundle implements the KeyBundleCache interface for KeyBundleCacheMeasured.
func (KeyBundleCacheMeasured) GetTLFWriterKeyBundle ¶
func (b KeyBundleCacheMeasured) GetTLFWriterKeyBundle( tlfID tlf.ID, bundleID TLFWriterKeyBundleID) (wkb *TLFWriterKeyBundleV3, err error)
GetTLFWriterKeyBundle implements the KeyBundleCache interface for KeyBundleCacheMeasured.
func (KeyBundleCacheMeasured) PutTLFReaderKeyBundle ¶
func (b KeyBundleCacheMeasured) PutTLFReaderKeyBundle( tlfID tlf.ID, bundleID TLFReaderKeyBundleID, rkb TLFReaderKeyBundleV3)
PutTLFReaderKeyBundle implements the KeyBundleCache interface for KeyBundleCacheMeasured.
func (KeyBundleCacheMeasured) PutTLFWriterKeyBundle ¶
func (b KeyBundleCacheMeasured) PutTLFWriterKeyBundle( tlfID tlf.ID, bundleID TLFWriterKeyBundleID, wkb TLFWriterKeyBundleV3)
PutTLFWriterKeyBundle implements the KeyBundleCache interface for KeyBundleCacheMeasured.
type KeyBundleCacheStandard ¶
type KeyBundleCacheStandard struct {
// contains filtered or unexported fields
}
KeyBundleCacheStandard is an LRU-based implementation of the KeyBundleCache interface.
func NewKeyBundleCacheStandard ¶
func NewKeyBundleCacheStandard(capacity int) *KeyBundleCacheStandard
NewKeyBundleCacheStandard constructs a new KeyBundleCacheStandard with the given cache capacity.
func (*KeyBundleCacheStandard) GetTLFReaderKeyBundle ¶
func (k *KeyBundleCacheStandard) GetTLFReaderKeyBundle( tlf tlf.ID, bundleID TLFReaderKeyBundleID) (*TLFReaderKeyBundleV3, error)
GetTLFReaderKeyBundle implements the KeyBundleCache interface for KeyBundleCacheStandard.
func (*KeyBundleCacheStandard) GetTLFWriterKeyBundle ¶
func (k *KeyBundleCacheStandard) GetTLFWriterKeyBundle( tlf tlf.ID, bundleID TLFWriterKeyBundleID) (*TLFWriterKeyBundleV3, error)
GetTLFWriterKeyBundle implements the KeyBundleCache interface for KeyBundleCacheStandard.
func (*KeyBundleCacheStandard) PutTLFReaderKeyBundle ¶
func (k *KeyBundleCacheStandard) PutTLFReaderKeyBundle( tlf tlf.ID, bundleID TLFReaderKeyBundleID, rkb TLFReaderKeyBundleV3)
PutTLFReaderKeyBundle implements the KeyBundleCache interface for KeyBundleCacheStandard.
func (*KeyBundleCacheStandard) PutTLFWriterKeyBundle ¶
func (k *KeyBundleCacheStandard) PutTLFWriterKeyBundle( tlf tlf.ID, bundleID TLFWriterKeyBundleID, wkb TLFWriterKeyBundleV3)
PutTLFWriterKeyBundle implements the KeyBundleCache interface for KeyBundleCacheStandard.
type KeyCache ¶
type KeyCache interface { // GetTLFCryptKey gets the crypt key for the given TLF. GetTLFCryptKey(tlf.ID, KeyGen) (kbfscrypto.TLFCryptKey, error) // PutTLFCryptKey stores the crypt key for the given TLF. PutTLFCryptKey(tlf.ID, KeyGen, kbfscrypto.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 TLF ID 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 tlf.ID, keyGen KeyGen) (key kbfscrypto.TLFCryptKey, err error)
GetTLFCryptKey implements the KeyCache interface for KeyCacheMeasured.
func (KeyCacheMeasured) PutTLFCryptKey ¶
func (b KeyCacheMeasured) PutTLFCryptKey( tlfID tlf.ID, keyGen KeyGen, key kbfscrypto.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 TLF ID and key generation wasn't found in cache.
func (KeyCacheMissError) Error ¶
func (e KeyCacheMissError) Error() string
Error implements the error interface for KeyCacheMissError.
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 tlf.ID, keyGen KeyGen) ( kbfscrypto.TLFCryptKey, error)
GetTLFCryptKey implements the KeyCache interface for KeyCacheStandard.
func (*KeyCacheStandard) PutTLFCryptKey ¶
func (k *KeyCacheStandard) PutTLFCryptKey( tlf tlf.ID, keyGen KeyGen, key kbfscrypto.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 KeyGen = 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 { // 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 []kbfscrypto.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 there was an // error, or the RootMetadata wasn't changed, 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, *kbfscrypto.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 kbfscrypto.TLFCryptKey, err error)
GetTLFCryptKeyForBlockDecryption implements the KeyManager interface for KeyManagerStandard.
func (*KeyManagerStandard) GetTLFCryptKeyForEncryption ¶
func (km *KeyManagerStandard) GetTLFCryptKeyForEncryption(ctx context.Context, kmd KeyMetadata) (tlfCryptKey kbfscrypto.TLFCryptKey, err error)
GetTLFCryptKeyForEncryption implements the KeyManager interface for KeyManagerStandard.
func (*KeyManagerStandard) GetTLFCryptKeyForMDDecryption ¶
func (km *KeyManagerStandard) GetTLFCryptKeyForMDDecryption( ctx context.Context, kmdToDecrypt, kmdWithKeys KeyMetadata) ( tlfCryptKey kbfscrypto.TLFCryptKey, err error)
GetTLFCryptKeyForMDDecryption implements the KeyManager interface for KeyManagerStandard.
func (*KeyManagerStandard) GetTLFCryptKeyOfAllGenerations ¶
func (km *KeyManagerStandard) GetTLFCryptKeyOfAllGenerations( ctx context.Context, kmd KeyMetadata) ( keys []kbfscrypto.TLFCryptKey, err error)
GetTLFCryptKeyOfAllGenerations implements the KeyManager interface for KeyManagerStandard.
func (*KeyManagerStandard) Rekey ¶
func (km *KeyManagerStandard) Rekey(ctx context.Context, md *RootMetadata, promptPaper bool) ( mdChanged bool, cryptKey *kbfscrypto.TLFCryptKey, err error)
Rekey implements the KeyManager interface for KeyManagerStandard.
TODO: Make this less terrible. See KBFS-1799.
type KeyMetadata ¶
type KeyMetadata interface { // TlfID returns the ID of the TLF for which this object holds // key info. TlfID() tlf.ID // 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. Returns an error if the TLF // is public. HasKeyForUser(user keybase1.UID) (bool, error) // 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 kbfscrypto.CryptPublicKey) ( kbfscrypto.TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, TLFCryptKeyServerHalfID, bool, error) // StoresHistoricTLFCryptKeys returns whether or not history keys are // symmetrically encrypted; if not, they're encrypted per-device. StoresHistoricTLFCryptKeys() bool // GetHistoricTLFCryptKey attempts to symmetrically decrypt the key at the given // generation using the current generation's TLFCryptKey. GetHistoricTLFCryptKey(c cryptoPure, keyGen KeyGen, currentKey kbfscrypto.TLFCryptKey) ( kbfscrypto.TLFCryptKey, 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 kbfscrypto.CryptPublicKey) ( kbfscrypto.TLFCryptKeyServerHalf, error) // PutTLFCryptKeyServerHalves stores a server-side key halves for a // set of users and devices. PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) 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 kbfscrypto.CryptPublicKey) ( kbfscrypto.TLFCryptKeyServerHalf, error)
GetTLFCryptKeyServerHalf is an implementation of the KeyOps interface.
func (*KeyOpsStandard) PutTLFCryptKeyServerHalves ¶
func (k *KeyOpsStandard) PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) 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 kbfscrypto.CryptPublicKey) ( kbfscrypto.TLFCryptKeyServerHalf, error) // PutTLFCryptKeyServerHalves stores a server-side key halves for a // set of users and devices. PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) 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 kbfscrypto.CryptPublicKey) ( serverHalf kbfscrypto.TLFCryptKeyServerHalf, err error)
GetTLFCryptKeyServerHalf implements the KeyServer interface for KeyServerLocal.
func (*KeyServerLocal) PutTLFCryptKeyServerHalves ¶
func (ks *KeyServerLocal) PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) 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 kbfscrypto.CryptPublicKey) ( serverHalf kbfscrypto.TLFCryptKeyServerHalf, err error)
GetTLFCryptKeyServerHalf implements the KeyServer interface for KeyServerMeasured.
func (KeyServerMeasured) PutTLFCryptKeyServerHalves ¶
func (b KeyServerMeasured) PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) (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 kbfscodec.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 kbfscodec.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) EstablishMountDir ¶
func (k *KeybaseDaemonLocal) EstablishMountDir(ctx context.Context) (string, error)
EstablishMountDir implements the KeybaseDaemon interface 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) NotifySyncStatus ¶
func (k *KeybaseDaemonLocal) NotifySyncStatus(ctx context.Context, _ *keybase1.FSPathSyncStatus) error
NotifySyncStatus 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 // NotifySyncStatus sends a sync status notification. NotifySyncStatus(ctx context.Context, status *keybase1.FSPathSyncStatus) 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) // EstablishMountDir asks the service for the current mount path // and sets it if not established. EstablishMountDir(ctx context.Context) (string, error) // 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) EstablishMountDir ¶
func (k *KeybaseServiceBase) EstablishMountDir(ctx context.Context) ( string, error)
EstablishMountDir asks the service for the current mount path
func (*KeybaseServiceBase) FSEditListRequest ¶
func (k *KeybaseServiceBase) FSEditListRequest(ctx context.Context, req keybase1.FSEditListRequest) (err error)
FSEditListRequest implements keybase1.NotifyFSRequestInterface for KeybaseServiceBase.
func (*KeybaseServiceBase) FSSyncStatusRequest ¶
func (k *KeybaseServiceBase) FSSyncStatusRequest(ctx context.Context, req keybase1.FSSyncStatusRequest) (err error)
FSSyncStatusRequest 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, kbfsMountClient keybase1.KbfsMountInterface)
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) GetPublicCanonicalTLFNameAndID ¶
func (k *KeybaseServiceBase) GetPublicCanonicalTLFNameAndID( ctx context.Context, query keybase1.TLFQuery) ( res keybase1.CanonicalTLFNameAndIDWithBreaks, err error)
GetPublicCanonicalTLFNameAndID implements the TlfKeysInterface interface for KeybaseServiceBase.
func (*KeybaseServiceBase) GetTLFCryptKeys ¶
func (k *KeybaseServiceBase) GetTLFCryptKeys(ctx context.Context, query keybase1.TLFQuery) (res keybase1.GetTLFCryptKeysRes, 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) NotifySyncStatus ¶
func (k *KeybaseServiceBase) NotifySyncStatus(ctx context.Context, status *keybase1.FSPathSyncStatus) error
NotifySyncStatus 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) EstablishMountDir ¶
func (k KeybaseServiceMeasured) EstablishMountDir(ctx context.Context) (string, error)
EstablishMountDir implements the KeybaseDaemon interface for KeybaseDaemonLocal.
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) NotifySyncStatus ¶
func (k KeybaseServiceMeasured) NotifySyncStatus(ctx context.Context, status *keybase1.FSPathSyncStatus) (err error)
NotifySyncStatus 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() kbfscrypto.CryptPublicKey
GetCurrentCryptPublicKey returns this LocalUser's public encryption key.
func (*LocalUser) GetCurrentVerifyingKey ¶
func (lu *LocalUser) GetCurrentVerifyingKey() kbfscrypto.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 TLF ID, // revision number, and branch ID (NullBranchID for merged MD). Get(tlf tlf.ID, rev MetadataRevision, bid BranchID) (ImmutableRootMetadata, error) // Put stores the metadata object. Put(md ImmutableRootMetadata) error // Delete removes the given metadata object from the cache if it exists. Delete(tlf tlf.ID, rev MetadataRevision, bid BranchID) // Replace replaces the entry matching the md under the old branch // ID with the new one. If the old entry doesn't exist, this is // equivalent to a Put. Replace(newRmd ImmutableRootMetadata, oldBID BranchID) 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) Delete ¶
func (md *MDCacheStandard) Delete(tlf tlf.ID, rev MetadataRevision, bid BranchID)
Delete implements the MDCache interface for MDCacheStandard.
func (*MDCacheStandard) Get ¶
func (md *MDCacheStandard) Get(tlf tlf.ID, 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.
func (*MDCacheStandard) Replace ¶
func (md *MDCacheStandard) Replace(newRmd ImmutableRootMetadata, oldBID BranchID) error
Replace 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 tlf.ID 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 ¶
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. // // If there is no returned error, then the returned ID must // always be non-null. An empty ImmutableRootMetadata may be // returned, but if it is non-empty, then its ID must match // the returned ID. GetForHandle( ctx context.Context, handle *TlfHandle, mStatus MergeStatus) ( tlf.ID, 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 tlf.ID) (ImmutableRootMetadata, error) // GetUnmergedForTLF is the same as the above but for unmerged // metadata. GetUnmergedForTLF(ctx context.Context, id tlf.ID, bid BranchID) ( ImmutableRootMetadata, error) // GetRange returns a range of metadata objects corresponding to // the passed revision numbers (inclusive). GetRange(ctx context.Context, id tlf.ID, start, stop MetadataRevision) ( []ImmutableRootMetadata, error) // GetUnmergedRange is the same as the above but for unmerged // metadata history (inclusive). GetUnmergedRange(ctx context.Context, id tlf.ID, 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 tlf.ID, bid BranchID) error // ResolveBranch prunes all unmerged history for the given TLF // branch, and also deletes any blocks in `blocksToDelete` that // are still in the local journal. It also appends the given MD // to the journal. ResolveBranch(ctx context.Context, id tlf.ID, bid BranchID, blocksToDelete []kbfsblock.ID, rmd *RootMetadata) (MdID, 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 tlf.ID) ( tlf.Handle, 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) (id tlf.ID, rmd ImmutableRootMetadata, err error)
GetForHandle implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetForTLF ¶
func (md *MDOpsStandard) GetForTLF(ctx context.Context, id tlf.ID) ( ImmutableRootMetadata, error)
GetForTLF implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetLatestHandleForTLF ¶
GetLatestHandleForTLF implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetRange ¶
func (md *MDOpsStandard) GetRange(ctx context.Context, id tlf.ID, start, stop MetadataRevision) ([]ImmutableRootMetadata, error)
GetRange implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetUnmergedForTLF ¶
func (md *MDOpsStandard) GetUnmergedForTLF( ctx context.Context, id tlf.ID, bid BranchID) ( ImmutableRootMetadata, error)
GetUnmergedForTLF implements the MDOps interface for MDOpsStandard.
func (*MDOpsStandard) GetUnmergedRange ¶
func (md *MDOpsStandard) GetUnmergedRange(ctx context.Context, id tlf.ID, 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.
func (*MDOpsStandard) ResolveBranch ¶
func (md *MDOpsStandard) ResolveBranch( ctx context.Context, id tlf.ID, bid BranchID, _ []kbfsblock.ID, rmd *RootMetadata) (MdID, error)
ResolveBranch 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 { // 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. // // If there is no returned error, then the returned ID must // always be non-null. A nil *RootMetadataSigned may be // returned, but if it is non-nil, then its ID must match the // returned ID. GetForHandle(ctx context.Context, handle tlf.Handle, mStatus MergeStatus) (tlf.ID, *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 tlf.ID, 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 tlf.ID, 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, extra ExtraMetadata) error // PruneBranch prunes all unmerged history for the given TLF branch. PruneBranch(ctx context.Context, id tlf.ID, 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 tlf.ID, currHead MetadataRevision) (<-chan error, error) // CancelRegistration lets the local MDServer instance know that // we are no longer interested in updates for the specified // folder. It does not necessarily forward this cancellation to // remote servers. CancelRegistration(ctx context.Context, id tlf.ID) // 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 tlf.ID) (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 tlf.ID) (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 tlf.ID) ( tlf.Handle, 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) // GetKeyBundles looks up the key bundles for the given key // bundle IDs. tlfID must be non-zero but either or both wkbID // and rkbID can be zero, in which case nil will be returned // for the respective bundle. If a bundle cannot be found, an // error is returned and nils are returned for both bundles. GetKeyBundles(ctx context.Context, tlfID tlf.ID, wkbID TLFWriterKeyBundleID, rkbID TLFReaderKeyBundleID) ( *TLFWriterKeyBundleV3, *TLFReaderKeyBundleV3, error) // contains filtered or unexported methods }
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 mdServerLocalConfig, dirPath string) (*MDServerDisk, error)
NewMDServerDir constructs a new MDServerDisk that stores its data in the given directory.
func NewMDServerTempDir ¶
func NewMDServerTempDir(config mdServerLocalConfig) (*MDServerDisk, error)
NewMDServerTempDir constructs a new MDServerDisk that stores its data in a temp directory which is cleaned up on shutdown.
func (*MDServerDisk) CancelRegistration ¶
func (md *MDServerDisk) CancelRegistration(_ context.Context, id tlf.ID)
CancelRegistration implements the MDServer interface for MDServerDisk.
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 tlf.Handle, mStatus MergeStatus) (tlf.ID, *RootMetadataSigned, error)
GetForHandle implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) GetForTLF ¶
func (md *MDServerDisk) GetForTLF(ctx context.Context, id tlf.ID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
GetForTLF implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) GetKeyBundles ¶
func (md *MDServerDisk) GetKeyBundles(ctx context.Context, tlfID tlf.ID, wkbID TLFWriterKeyBundleID, rkbID TLFReaderKeyBundleID) ( *TLFWriterKeyBundleV3, *TLFReaderKeyBundleV3, error)
GetKeyBundles implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) GetLatestHandleForTLF ¶
GetLatestHandleForTLF implements the MDServer interface for MDServerDisk.
func (*MDServerDisk) GetRange ¶
func (md *MDServerDisk) GetRange(ctx context.Context, id tlf.ID, 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, extra ExtraMetadata) 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 tlf.ID, 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 MDServerErrorCannotReadFinalizedTLF ¶
type MDServerErrorCannotReadFinalizedTLF struct{}
MDServerErrorCannotReadFinalizedTLF is returned when the client isn't authorized to read a finalized TLF.
func (MDServerErrorCannotReadFinalizedTLF) Error ¶
func (e MDServerErrorCannotReadFinalizedTLF) Error() string
Error implements the Error interface for MDServerErrorCannotReadFinalizedTLF.
func (MDServerErrorCannotReadFinalizedTLF) ToStatus ¶
func (e MDServerErrorCannotReadFinalizedTLF) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorCannotReadFinalizedTLF.
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 MDServerErrorTooManyFoldersCreated ¶
MDServerErrorTooManyFoldersCreated is returned when a user has created more folders than their limit allows.
func (MDServerErrorTooManyFoldersCreated) Error ¶
func (e MDServerErrorTooManyFoldersCreated) Error() string
Error implements the Error interface for MDServerErrorTooManyFoldersCreated.
func (MDServerErrorTooManyFoldersCreated) ToStatus ¶
func (e MDServerErrorTooManyFoldersCreated) ToStatus() (s keybase1.Status)
ToStatus implements the ExportableError interface for MDServerErrorConflictFolderMapping
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 mdServerLocalConfig) (*MDServerMemory, error)
NewMDServerMemory constructs a new MDServerMemory object that stores all data in-memory.
func (*MDServerMemory) CancelRegistration ¶
func (md *MDServerMemory) CancelRegistration(_ context.Context, id tlf.ID)
CancelRegistration implements the MDServer interface for MDServerMemory.
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 tlf.Handle, mStatus MergeStatus) (tlf.ID, *RootMetadataSigned, error)
GetForHandle implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) GetForTLF ¶
func (md *MDServerMemory) GetForTLF(ctx context.Context, id tlf.ID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
GetForTLF implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) GetKeyBundles ¶
func (md *MDServerMemory) GetKeyBundles(ctx context.Context, tlfID tlf.ID, wkbID TLFWriterKeyBundleID, rkbID TLFReaderKeyBundleID) ( *TLFWriterKeyBundleV3, *TLFReaderKeyBundleV3, error)
GetKeyBundles implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) GetLatestHandleForTLF ¶
func (md *MDServerMemory) GetLatestHandleForTLF( ctx context.Context, id tlf.ID) (tlf.Handle, error)
GetLatestHandleForTLF implements the MDServer interface for MDServerMemory.
func (*MDServerMemory) GetRange ¶
func (md *MDServerMemory) GetRange(ctx context.Context, id tlf.ID, 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, extra ExtraMetadata) 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 tlf.ID, 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, rpcLogFactory *libkb.RPCLogFactory) *MDServerRemote
NewMDServerRemote returns a new instance of MDServerRemote.
func (*MDServerRemote) CancelRegistration ¶
func (md *MDServerRemote) CancelRegistration(ctx context.Context, id tlf.ID)
CancelRegistration implements the MDServer interface for 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(ctx context.Context, arg keybase1.FolderNeedsRekeyArg) error
FolderNeedsRekey implements the MetadataUpdateProtocol interface.
func (*MDServerRemote) FoldersNeedRekey ¶
func (md *MDServerRemote) FoldersNeedRekey(ctx context.Context, requests []keybase1.RekeyRequest) error
FoldersNeedRekey implements the MetadataUpdateProtocol interface.
func (*MDServerRemote) GetForHandle ¶
func (md *MDServerRemote) GetForHandle(ctx context.Context, handle tlf.Handle, mStatus MergeStatus) ( tlf.ID, *RootMetadataSigned, error)
GetForHandle implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) GetForTLF ¶
func (md *MDServerRemote) GetForTLF(ctx context.Context, id tlf.ID, bid BranchID, mStatus MergeStatus) (*RootMetadataSigned, error)
GetForTLF implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) GetKeyBundles ¶
func (md *MDServerRemote) GetKeyBundles(ctx context.Context, tlf tlf.ID, wkbID TLFWriterKeyBundleID, rkbID TLFReaderKeyBundleID) ( *TLFWriterKeyBundleV3, *TLFReaderKeyBundleV3, error)
GetKeyBundles implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) GetLatestHandleForTLF ¶
func (md *MDServerRemote) GetLatestHandleForTLF(ctx context.Context, id tlf.ID) ( tlf.Handle, error)
GetLatestHandleForTLF implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) GetRange ¶
func (md *MDServerRemote) GetRange(ctx context.Context, id tlf.ID, 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 kbfscrypto.CryptPublicKey) ( serverHalf kbfscrypto.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, extra ExtraMetadata) error
Put implements the MDServer interface for MDServerRemote.
func (*MDServerRemote) PutTLFCryptKeyServerHalves ¶
func (md *MDServerRemote) PutTLFCryptKeyServerHalves(ctx context.Context, keyServerHalves UserDeviceKeyServerHalves) 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 tlf.ID, 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 *kbfscrypto.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) Errno ¶
func (e MetadataIsFinalError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for MetadataIsFinalError.
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.
const ( // FirstValidMetadataVer is the first value that is considered a // valid data version. For historical reasons 0 is considered // valid. FirstValidMetadataVer MetadataVer = 0 // PreExtraMetadataVer is the latest metadata version that did not include // support for extra MD fields. PreExtraMetadataVer MetadataVer = 1 // InitialExtraMetadataVer is the first metadata version that did // include support for extra MD fields. InitialExtraMetadataVer MetadataVer = 2 // SegregatedKeyBundlesVer is the first metadata version to allow separate // storage of key bundles. SegregatedKeyBundlesVer MetadataVer = 3 )
func (MetadataVer) String ¶
func (v MetadataVer) String() string
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) // SignWriterMetadataInternally signs the writer metadata, for // versions that store this signature inside the metadata. SignWriterMetadataInternally(ctx context.Context, codec kbfscodec.Codec, signer kbfscrypto.Signer) error // 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) // SetUnresolvedReaders sets the list of unresolved readers associated with this folder. SetUnresolvedReaders(readers []keybase1.SocialAssertion) // SetUnresolvedWriters sets the list of unresolved writers associated with this folder. SetUnresolvedWriters(writers []keybase1.SocialAssertion) // SetConflictInfo sets any conflict info associated with this metadata revision. SetConflictInfo(ci *tlf.HandleExtension) // SetFinalizedInfo sets any finalized info associated with this metadata revision. SetFinalizedInfo(fi *tlf.HandleExtension) // 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 tlf.ID) // AddKeyGeneration adds a new key generation to this revision // of metadata. If StoresHistoricTLFCryptKeys is false, then // currCryptKey must be zero. Otherwise, currCryptKey must be // zero if there are no existing key generations, and non-zero // for otherwise. // // AddKeyGeneration must only be called on metadata for // private TLFs. // // Note that the TLFPrivateKey corresponding to privKey must // also be stored in PrivateMetadata. AddKeyGeneration(codec kbfscodec.Codec, crypto cryptoPure, currExtra ExtraMetadata, updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, ePubKey kbfscrypto.TLFEphemeralPublicKey, ePrivKey kbfscrypto.TLFEphemeralPrivateKey, pubKey kbfscrypto.TLFPublicKey, currCryptKey, nextCryptKey kbfscrypto.TLFCryptKey) ( nextExtra ExtraMetadata, serverHalves UserDeviceKeyServerHalves, err error) // UpdateKeyBundles ensures that every device for every writer // and reader in the provided lists has complete TLF crypt key // info, and uses the new ephemeral key pair to generate the // info if it doesn't yet exist. tlfCryptKeys must contain an // entry for each key generation in KeyGenerationsToUpdate(), // in ascending order. // // updatedWriterKeys and updatedReaderKeys usually contains // the full maps of writers to per-device crypt public keys, // but for reader rekey, updatedWriterKeys will be empty and // updatedReaderKeys will contain only a single entry. // // UpdateKeyBundles must only be called on metadata for // private TLFs. // // An array of server halves to push to the server are // returned, with each entry corresponding to each key // generation in KeyGenerationsToUpdate(), in ascending order. UpdateKeyBundles(crypto cryptoPure, extra ExtraMetadata, updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, ePubKey kbfscrypto.TLFEphemeralPublicKey, ePrivKey kbfscrypto.TLFEphemeralPrivateKey, tlfCryptKeys []kbfscrypto.TLFCryptKey) ( []UserDeviceKeyServerHalves, error) // PromoteReaders converts the given set of users (which may // be empty) from readers to writers. PromoteReaders(readersToPromote map[keybase1.UID]bool, extra ExtraMetadata) error // RevokeRemovedDevices removes key info for any device not in // the given maps, and returns a corresponding map of server // halves to delete from the server. // // Note: the returned server halves may not be for all key // generations, e.g. for MDv3 it's only for the latest key // generation. RevokeRemovedDevices( updatedWriterKeys, updatedReaderKeys UserDevicePublicKeys, extra ExtraMetadata) (ServerHalfRemovalInfo, error) // FinalizeRekey must be called called after all rekeying work // has been performed on the underlying metadata. FinalizeRekey(c cryptoPure, extra ExtraMetadata) error }
MutableBareRootMetadata is a mutable interface to the bare serializeable MD that is signed by the reader or writer.
func DecodeRootMetadata ¶
func DecodeRootMetadata(codec kbfscodec.Codec, tlf tlf.ID, ver, max MetadataVer, buf []byte) ( MutableBareRootMetadata, error)
DecodeRootMetadata deserializes a metadata block into the specified versioned structure.
func MakeInitialBareRootMetadata ¶
func MakeInitialBareRootMetadata( ver MetadataVer, tlfID tlf.ID, h tlf.Handle) ( MutableBareRootMetadata, error)
MakeInitialBareRootMetadata creates a new MutableBareRootMetadata instance of the given MetadataVer with revision MetadataRevisionInitial, and the given TLF ID and handle. Note that if the given ID/handle are private, rekeying must be done separately.
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 BlockServer 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, maxStalls int)
StallBlockOp wraps the internal BlockServer 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, maxStalls int, stallDelegate bool)
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 Err error }
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
func (NeedOtherRekeyError) ToStatus ¶
func (e NeedOtherRekeyError) ToStatus() keybase1.Status
ToStatus exports error to status
type NeedSelfRekeyError ¶
type NeedSelfRekeyError struct { Tlf CanonicalTlfName Err error }
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
func (NeedSelfRekeyError) ToStatus ¶
func (e NeedSelfRekeyError) ToStatus() keybase1.Status
ToStatus exports error to status
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 tlf.ID 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 NoCancellationDelayerError ¶
type NoCancellationDelayerError struct{}
NoCancellationDelayerError is returned when EnableDelayedCancellationWithGracePeriod or ExitCritical are called on a ctx without Critical Awareness
func (NoCancellationDelayerError) Error ¶
func (e NoCancellationDelayerError) Error() string
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 NoMergedMDError ¶
type NoMergedMDError struct {
// contains filtered or unexported fields
}
NoMergedMDError indicates that no MDs for this folder have been created yet.
func (NoMergedMDError) Error ¶
func (e NoMergedMDError) Error() string
Error implements the error interface for NoMergedMDError.
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 ¶
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 tlf.ID 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 ¶
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 ¶
func GetRootNodeForTest( ctx context.Context, config Config, name string, public bool) (Node, error)
GetRootNodeForTest gets the root node for the given TLF name, which must be canonical, creating it if necessary.
func GetRootNodeOrBust ¶
func GetRootNodeOrBust( ctx context.Context, t logger.TestLogBackend, config Config, name string, public bool) Node
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. Returns whether the pointer was updated. UpdatePointer(oldRef BlockRef, newPtr BlockPointer) bool // 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. // Returns whether a node was actually updated. Unlink(ref BlockRef, oldPath path) bool // PathFromNode creates the path up to a given Node. PathFromNode(node Node) path // AllNodes returns the complete set of nodes currently in the cache. AllNodes() []Node }
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 NodeMetadata ¶
type NodeMetadata struct { // LastWriterUnverified is the last writer of this // node according to the last writer of the TLF. // A more thorough check is possible in the future. LastWriterUnverified libkb.NormalizedUsername BlockInfo BlockInfo }
NodeMetadata has metadata about a node needed for higher level operations.
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) DelUnrefBlock ¶
func (oc *OpCommon) DelUnrefBlock(ptr BlockPointer)
DelUnrefBlock removes the first unreference of the given block from the list of unreferenced 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 PathType ¶
type PathType string
PathType describes the types for different paths
const ( // KeybasePathType is the keybase root (like /keybase) KeybasePathType PathType = "keybase" // PublicPathType is the keybase public (like /keybase/public) PublicPathType PathType = "public" // PrivatePathType is the keybase private (like /keybase/private) PrivatePathType PathType = "private" )
type PreferredTlfName ¶
type PreferredTlfName string
PreferredTlfName is a preferred Tlf name.
func FavoriteNameToPreferredTLFNameFormatAs ¶
func FavoriteNameToPreferredTLFNameFormatAs(username libkb.NormalizedUsername, canon CanonicalTlfName) (PreferredTlfName, error)
FavoriteNameToPreferredTLFNameFormatAs formats a favorite names for display with the username given. An empty username is allowed here and results in tlfname being returned unmodified.
type Prefetcher ¶
type Prefetcher interface { // PrefetchBlock directs the prefetcher to prefetch a block. PrefetchBlock(block Block, blockPtr BlockPointer, kmd KeyMetadata, priority int) error // PrefetchAfterBlockRetrieved allows the prefetcher to trigger prefetches // after a block has been retrieved. Whichever component is responsible for // retrieving blocks will call this method once it's done retrieving a // block. It caches if it has triggered a prefetch. PrefetchAfterBlockRetrieved(b Block, blockPtr BlockPointer, kmd KeyMetadata, priority int, lifetime BlockCacheLifetime, hasPrefetched bool) // Shutdown shuts down the prefetcher idempotently. Future calls to // the various Prefetch* methods will return io.EOF. The returned channel // allows upstream components to block until all pending prefetches are // complete. This feature is mainly used for testing, but also to toggle // the prefetcher on and off. Shutdown() <-chan struct{} }
Prefetcher is an interface to a block prefetcher.
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/docs/crypto/kbfs. TLFPrivateKey kbfscrypto.TLFPrivateKey // The block changes done as part of the update that created this MD Changes BlockChanges // The last revision up to and including which garbage collection // was performed on this TLF. LastGCRevision MetadataRevision `codec:"lgc"` 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 ReadAccessError ¶
type ReadAccessError struct { User libkb.NormalizedUsername Filename string 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. If the TLF is already in the // rekey queue, the error channel of the existing one is returned. Enqueue(tlf.ID) <-chan error // IsRekeyPending returns true if the given folder is in the rekey queue. // Note that a rekey request that a worker has already picked up and is // working on doesn't count as "pending". IsRekeyPending(tlf.ID) bool // 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 tlf.ID) <-chan error
Enqueue implements the RekeyQueue interface for RekeyQueueStandard.
func (*RekeyQueueStandard) IsRekeyPending ¶
func (rkq *RekeyQueueStandard) IsRekeyPending(id tlf.ID) 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 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) // NotifySyncStatus sends the given path sync status to any sink. NotifySyncStatus(ctx context.Context, status *keybase1.FSPathSyncStatus) // 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) NotifySyncStatus ¶
func (r *ReporterKBPKI) NotifySyncStatus(ctx context.Context, status *keybase1.FSPathSyncStatus)
NotifySyncStatus 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) NotifySyncStatus ¶
func (r *ReporterSimple) NotifySyncStatus(_ context.Context, _ *keybase1.FSPathSyncStatus)
NotifySyncStatus 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 (*RootMetadata) AddDiskUsage ¶
func (md *RootMetadata) AddDiskUsage(diskUsage uint64)
AddDiskUsage wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) AddKeyGeneration ¶
func (md *RootMetadata) AddKeyGeneration(codec kbfscodec.Codec, crypto cryptoPure, wKeys, rKeys UserDevicePublicKeys, ePubKey kbfscrypto.TLFEphemeralPublicKey, ePrivKey kbfscrypto.TLFEphemeralPrivateKey, pubKey kbfscrypto.TLFPublicKey, privKey kbfscrypto.TLFPrivateKey, currCryptKey, nextCryptKey kbfscrypto.TLFCryptKey) ( serverHalves UserDeviceKeyServerHalves, err error)
AddKeyGeneration adds a new key generation to this revision of metadata.
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) Extra ¶
func (md *RootMetadata) Extra() ExtraMetadata
Extra returns the extra metadata of this RootMetadata.
func (*RootMetadata) GetBareRootMetadata ¶
func (md *RootMetadata) GetBareRootMetadata() BareRootMetadata
GetBareRootMetadata returns an interface to the underlying serializeable metadata.
func (*RootMetadata) GetHistoricTLFCryptKey ¶
func (md *RootMetadata) GetHistoricTLFCryptKey( crypto cryptoPure, keyGen KeyGen, currentKey kbfscrypto.TLFCryptKey) (kbfscrypto.TLFCryptKey, error)
GetHistoricTLFCryptKey implements the KeyMetadata interface for RootMetadata.
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 kbfscodec.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 kbfscrypto.CryptPublicKey) ( kbfscrypto.TLFEphemeralPublicKey, EncryptedTLFCryptKeyClientHalf, TLFCryptKeyServerHalfID, bool, error)
GetTLFCryptKeyParams wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) GetTLFReaderKeyBundleID ¶
func (md *RootMetadata) GetTLFReaderKeyBundleID() TLFReaderKeyBundleID
GetTLFReaderKeyBundleID returns the ID of the externally-stored reader key bundle, or the zero value if this object stores it internally.
func (*RootMetadata) GetTLFWriterKeyBundleID ¶
func (md *RootMetadata) GetTLFWriterKeyBundleID() TLFWriterKeyBundleID
GetTLFWriterKeyBundleID returns the ID of the externally-stored writer key bundle, or the zero value if this object stores it internally.
func (*RootMetadata) GetTlfHandle ¶
func (md *RootMetadata) GetTlfHandle() *TlfHandle
GetTlfHandle returns the TlfHandle for this RootMetadata.
func (*RootMetadata) HasKeyForUser ¶
func (md *RootMetadata) HasKeyForUser(user keybase1.UID) ( bool, error)
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) KeyGenerationsToUpdate ¶
func (md *RootMetadata) KeyGenerationsToUpdate() (KeyGen, KeyGen)
KeyGenerationsToUpdate 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) LatestKeyGeneration ¶
func (md *RootMetadata) LatestKeyGeneration() KeyGen
LatestKeyGeneration wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) MakeBareTlfHandle ¶
func (md *RootMetadata) MakeBareTlfHandle() (tlf.Handle, error)
MakeBareTlfHandle makes a BareTlfHandle for this RootMetadata. Should be used only by servers and MDOps.
func (*RootMetadata) MakeSuccessor ¶
func (md *RootMetadata) MakeSuccessor( ctx context.Context, latestMDVer MetadataVer, codec kbfscodec.Codec, crypto cryptoPure, keyManager KeyManager, 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 *tlf.HandleExtension)
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 *tlf.HandleExtension)
SetFinalizedInfo wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) SetLastGCRevision ¶
func (md *RootMetadata) SetLastGCRevision(rev MetadataRevision)
SetLastGCRevision sets the last revision up to and including which garbage collection was performed on this TLF.
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 tlf.ID)
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) SetWriters ¶
func (md *RootMetadata) SetWriters(writers []keybase1.UID)
SetWriters wraps the respective method of the underlying BareRootMetadata for convenience.
func (*RootMetadata) StoresHistoricTLFCryptKeys ¶
func (md *RootMetadata) StoresHistoricTLFCryptKeys() bool
StoresHistoricTLFCryptKeys implements the KeyMetadata interface for RootMetadata.
func (*RootMetadata) TlfID ¶
func (md *RootMetadata) TlfID() tlf.ID
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) Version ¶
func (md *RootMetadata) Version() MetadataVer
Version returns the underlying BareRootMetadata version.
type RootMetadataSigned ¶
type RootMetadataSigned struct { // SigInfo is the signature over the root metadata by the // last modifying user's private signing key. SigInfo kbfscrypto.SignatureInfo // WriterSigInfo is the signature over the writer metadata by // the last modifying writer's private signing key. WriterSigInfo kbfscrypto.SignatureInfo // all the metadata MD BareRootMetadata // contains filtered or unexported fields }
RootMetadataSigned is the top-level MD object stored in MD server
TODO: Have separate types for:
- The in-memory client representation (needs untrustedServerTimestamp); - the type sent over RPC; - the type stored in the journal; - and the type stored in the MD server.
func DecodeRootMetadataSigned ¶
func DecodeRootMetadataSigned( codec kbfscodec.Codec, tlf tlf.ID, ver, max MetadataVer, buf []byte, untrustedServerTimestamp time.Time) ( *RootMetadataSigned, error)
DecodeRootMetadataSigned deserializes a metadata block into the specified versioned structure.
func SignBareRootMetadata ¶
func SignBareRootMetadata( ctx context.Context, codec kbfscodec.Codec, rootMetadataSigner, writerMetadataSigner kbfscrypto.Signer, brmd BareRootMetadata, untrustedServerTimestamp time.Time) ( *RootMetadataSigned, error)
SignBareRootMetadata signs the given BareRootMetadata and returns a *RootMetadataSigned object. rootMetadataSigner and writerMetadataSigner should be the same, except in tests.
func (*RootMetadataSigned) GetWriterMetadataSigInfo ¶
func (rmds *RootMetadataSigned) GetWriterMetadataSigInfo() kbfscrypto.SignatureInfo
GetWriterMetadataSigInfo returns the signature of the writer metadata.
func (*RootMetadataSigned) IsLastModifiedBy ¶
func (rmds *RootMetadataSigned) IsLastModifiedBy( uid keybase1.UID, key kbfscrypto.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 kbfscodec.Codec, crypto cryptoPure, extra ExtraMetadata) 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( codec kbfscodec.Codec, now time.Time, finalizedInfo *tlf.HandleExtension) (*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(crypto cryptoPure) (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 ServerHalfRemovalInfo ¶
ServerHalfRemovalInfo is a map from users and devices to a list of server half IDs to remove from the server.
type SessionInfo ¶
type SessionInfo struct { Name libkb.NormalizedUsername UID keybase1.UID Token string CryptPublicKey kbfscrypto.CryptPublicKey VerifyingKey kbfscrypto.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 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 ¶
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 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 TLF{Writer,Reader}KeyBundleV{2,3}.
type TLFCryptKeyNotPerDeviceEncrypted ¶
type TLFCryptKeyNotPerDeviceEncrypted struct {
// contains filtered or unexported fields
}
TLFCryptKeyNotPerDeviceEncrypted is returned when a given TLFCryptKey is not encrypted per-device but rather symmetrically encrypted with the current generation of the TLFCryptKey.
func (TLFCryptKeyNotPerDeviceEncrypted) Error ¶
func (e TLFCryptKeyNotPerDeviceEncrypted) Error() string
// Error implements the error interface for TLFCryptKeyNotPerDeviceEncrypted
type TLFCryptKeyServerHalfID ¶
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 TLFJournalBackgroundWorkStatus ¶
type TLFJournalBackgroundWorkStatus int
TLFJournalBackgroundWorkStatus indicates whether a journal should be doing background work or not.
const ( // TLFJournalBackgroundWorkPaused indicates that the journal // should not currently be doing background work. TLFJournalBackgroundWorkPaused TLFJournalBackgroundWorkStatus = iota // TLFJournalBackgroundWorkEnabled indicates that the journal // should be doing background work. TLFJournalBackgroundWorkEnabled )
func (TLFJournalBackgroundWorkStatus) String ¶
func (bws TLFJournalBackgroundWorkStatus) String() string
type TLFJournalStatus ¶
type TLFJournalStatus struct { Dir string RevisionStart MetadataRevision RevisionEnd MetadataRevision BranchID string BlockOpCount uint64 // The byte counters below are signed because // os.FileInfo.Size() is signed. StoredBytes int64 UnflushedBytes int64 UnflushedPaths []string LastFlushErr string `json:",omitempty"` }
TLFJournalStatus represents the status of a TLF's journal for display in diagnostics. It is suitable for encoding directly as JSON.
type TLFReaderKeyBundleID ¶
type TLFReaderKeyBundleID struct {
// contains filtered or unexported fields
}
TLFReaderKeyBundleID is the hash of a serialized TLFReaderKeyBundle.
func TLFReaderKeyBundleIDFromBytes ¶
func TLFReaderKeyBundleIDFromBytes(data []byte) (TLFReaderKeyBundleID, error)
TLFReaderKeyBundleIDFromBytes creates a new TLFReaderKeyBundleID from the given bytes. If the returned error is nil, the returned TLFReaderKeyBundleID is valid.
func TLFReaderKeyBundleIDFromString ¶
func TLFReaderKeyBundleIDFromString(id string) (TLFReaderKeyBundleID, error)
TLFReaderKeyBundleIDFromString creates a new TLFReaderKeyBundleID from the given string. If the returned error is nil, the returned TLFReaderKeyBundleID is valid.
func (TLFReaderKeyBundleID) Bytes ¶
func (h TLFReaderKeyBundleID) Bytes() []byte
Bytes returns the bytes of the TLFReaderKeyBundleID.
func (TLFReaderKeyBundleID) IsNil ¶
func (h TLFReaderKeyBundleID) IsNil() bool
IsNil returns true if the ID is unset.
func (TLFReaderKeyBundleID) MarshalBinary ¶
func (h TLFReaderKeyBundleID) MarshalBinary() (data []byte, err error)
MarshalBinary implements the encoding.BinaryMarshaler interface for TLFReaderKeyBundleID. Returns an error if the TLFReaderKeyBundleID is invalid and not the zero TLFReaderKeyBundleID.
func (TLFReaderKeyBundleID) String ¶
func (h TLFReaderKeyBundleID) String() string
String returns the string form of the TLFReaderKeyBundleID.
func (*TLFReaderKeyBundleID) UnmarshalBinary ¶
func (h *TLFReaderKeyBundleID) UnmarshalBinary(data []byte) error
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for TLFReaderKeyBundleID. Returns an error if the given byte array is non-empty and the TLFReaderKeyBundleID is invalid.
type TLFReaderKeyBundleV2 ¶
type TLFReaderKeyBundleV2 struct { RKeys UserDeviceKeyInfoMapV2 // M_e as described in § 4.1.1. 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 kbfscrypto.TLFEphemeralPublicKeys `codec:"readerEPubKey,omitempty"` codec.UnknownFieldSetHandler }
TLFReaderKeyBundleV2 stores all the reader keys with reader permissions on a TLF.
func NewEmptyTLFReaderKeyBundle ¶
func NewEmptyTLFReaderKeyBundle() TLFReaderKeyBundleV2
NewEmptyTLFReaderKeyBundle creates a new empty TLFReaderKeyBundleV2
type TLFReaderKeyBundleV3 ¶
type TLFReaderKeyBundleV3 struct { Keys UserDeviceKeyInfoMapV3 `codec:"rKeys,omitempty"` // M_e as described in § 4.1.1. 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. TLFEphemeralPublicKeys kbfscrypto.TLFEphemeralPublicKeys `codec:"rEPubKey,omitempty"` codec.UnknownFieldSetHandler }
TLFReaderKeyBundleV3 stores all the reader keys with reader permissions on a TLF.
func DeserializeTLFReaderKeyBundleV3 ¶
func DeserializeTLFReaderKeyBundleV3(codec kbfscodec.Codec, path string) ( TLFReaderKeyBundleV3, error)
DeserializeTLFReaderKeyBundleV3 deserializes a TLFReaderKeyBundleV3 from the given path and returns it.
func (TLFReaderKeyBundleV3) DeepCopy ¶
func (rkb TLFReaderKeyBundleV3) DeepCopy(codec kbfscodec.Codec) ( TLFReaderKeyBundleV3, error)
DeepCopy creates a deep copy of this key bundle.
type TLFReaderKeyGenerationsV2 ¶
type TLFReaderKeyGenerationsV2 []TLFReaderKeyBundleV2
TLFReaderKeyGenerationsV2 stores a slice of TLFReaderKeyBundleV2, where the last element is the current generation.
func (TLFReaderKeyGenerationsV2) IsReader ¶
IsReader returns whether or not the user+device is an authorized reader for the latest generation.
func (TLFReaderKeyGenerationsV2) LatestKeyGeneration ¶
func (rkg TLFReaderKeyGenerationsV2) LatestKeyGeneration() KeyGen
LatestKeyGeneration returns the current key generation for this TLF.
func (TLFReaderKeyGenerationsV2) ToTLFReaderKeyBundleV3 ¶
func (rkg TLFReaderKeyGenerationsV2) ToTLFReaderKeyBundleV3( codec kbfscodec.Codec, wkb TLFWriterKeyBundleV2) ( TLFReaderKeyBundleV3, error)
ToTLFReaderKeyBundleV3 converts a TLFReaderKeyGenerationsV2 to a TLFReaderkeyBundleV3.
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 TLFWriterKeyBundleID ¶
type TLFWriterKeyBundleID struct {
// contains filtered or unexported fields
}
TLFWriterKeyBundleID is the hash of a serialized TLFWriterKeyBundle.
func TLFWriterKeyBundleIDFromBytes ¶
func TLFWriterKeyBundleIDFromBytes(data []byte) (TLFWriterKeyBundleID, error)
TLFWriterKeyBundleIDFromBytes creates a new TLFWriterKeyBundleID from the given bytes. If the returned error is nil, the returned TLFWriterKeyBundleID is valid.
func TLFWriterKeyBundleIDFromString ¶
func TLFWriterKeyBundleIDFromString(id string) (TLFWriterKeyBundleID, error)
TLFWriterKeyBundleIDFromString creates a new TLFWriterKeyBundleID from the given string. If the returned error is nil, the returned TLFWriterKeyBundleID is valid.
func (TLFWriterKeyBundleID) Bytes ¶
func (h TLFWriterKeyBundleID) Bytes() []byte
Bytes returns the bytes of the TLFWriterKeyBundleID.
func (TLFWriterKeyBundleID) IsNil ¶
func (h TLFWriterKeyBundleID) IsNil() bool
IsNil returns true if the ID is unset.
func (TLFWriterKeyBundleID) MarshalBinary ¶
func (h TLFWriterKeyBundleID) MarshalBinary() (data []byte, err error)
MarshalBinary implements the encoding.BinaryMarshaler interface for TLFWriterKeyBundleID. Returns an error if the TLFWriterKeyBundleID is invalid and not the zero TLFWriterKeyBundleID.
func (TLFWriterKeyBundleID) String ¶
func (h TLFWriterKeyBundleID) String() string
String returns the string form of the TLFWriterKeyBundleID.
func (*TLFWriterKeyBundleID) UnmarshalBinary ¶
func (h *TLFWriterKeyBundleID) UnmarshalBinary(data []byte) error
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for TLFWriterKeyBundleID. Returns an error if the given byte array is non-empty and the TLFWriterKeyBundleID is invalid.
type TLFWriterKeyBundleV2 ¶
type TLFWriterKeyBundleV2 struct { // Maps from each writer to their crypt key bundle. WKeys UserDeviceKeyInfoMapV2 // M_f as described in § 4.1.1. TLFPublicKey kbfscrypto.TLFPublicKey `codec:"pubKey"` // M_e as described in § 4.1.1. 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 kbfscrypto.TLFEphemeralPublicKeys `codec:"ePubKey"` codec.UnknownFieldSetHandler }
TLFWriterKeyBundleV2 is a bundle of all the writer keys for a top-level folder.
func NewEmptyTLFWriterKeyBundle ¶
func NewEmptyTLFWriterKeyBundle() TLFWriterKeyBundleV2
NewEmptyTLFWriterKeyBundle creates a new empty TLFWriterKeyBundleV2
type TLFWriterKeyBundleV3 ¶
type TLFWriterKeyBundleV3 struct { // Maps from each user to their crypt key bundle for the current generation. Keys UserDeviceKeyInfoMapV3 `codec:"wKeys"` // M_f as described in § 4.1.1. TLFPublicKey kbfscrypto.TLFPublicKey `codec:"pubKey"` // M_e as described in § 4.1.1. 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 kbfscrypto.TLFEphemeralPublicKeys `codec:"ePubKey"` // This is a time-ordered encrypted list of historic key generations. // It is encrypted with the latest generation of the TLF crypt key. EncryptedHistoricTLFCryptKeys EncryptedTLFCryptKeys `codec:"oldKeys"` codec.UnknownFieldSetHandler }
TLFWriterKeyBundleV3 is a bundle of writer keys and historic symmetric encryption keys for a top-level folder.
func DeserializeTLFWriterKeyBundleV3 ¶
func DeserializeTLFWriterKeyBundleV3(codec kbfscodec.Codec, path string) ( TLFWriterKeyBundleV3, error)
DeserializeTLFWriterKeyBundleV3 deserializes a TLFWriterKeyBundleV3 from the given path and returns it.
func (TLFWriterKeyBundleV3) DeepCopy ¶
func (wkb TLFWriterKeyBundleV3) DeepCopy(codec kbfscodec.Codec) ( TLFWriterKeyBundleV3, error)
DeepCopy creates a deep copy of this key bundle.
type TLFWriterKeyGenerationsV2 ¶
type TLFWriterKeyGenerationsV2 []TLFWriterKeyBundleV2
TLFWriterKeyGenerationsV2 stores a slice of TLFWriterKeyBundleV2, where the last element is the current generation.
func (TLFWriterKeyGenerationsV2) IsWriter ¶
IsWriter returns whether or not the user+device is an authorized writer for the latest generation.
func (TLFWriterKeyGenerationsV2) LatestKeyGeneration ¶
func (wkg TLFWriterKeyGenerationsV2) LatestKeyGeneration() KeyGen
LatestKeyGeneration returns the current key generation for this TLF.
func (TLFWriterKeyGenerationsV2) ToTLFWriterKeyBundleV3 ¶
func (wkg TLFWriterKeyGenerationsV2) ToTLFWriterKeyBundleV3( codec kbfscodec.Codec, crypto cryptoPure, tlfCryptKeyGetter func() ([]kbfscrypto.TLFCryptKey, error)) ( TLFWriterKeyBundleV2, TLFWriterKeyBundleV3, error)
ToTLFWriterKeyBundleV3 converts a TLFWriterKeyGenerationsV2 to a TLFWriterKeyBundleV3.
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 ¶
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 tlf.Handle as well as additional info. This doesn't embed tlf.Handle to avoid having to keep track of data in multiple places.
func MakeTlfHandle ¶
func MakeTlfHandle( ctx context.Context, bareHandle tlf.Handle, nug normalizedUsernameGetter) (*TlfHandle, error)
MakeTlfHandle creates a TlfHandle from the given tlf.Handle 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.
TODO In future perhaps all code should switch over to preferred handles, and rename TlfNameNotCanonical to TlfNameNotPreferred.
func ParseTlfHandlePreferred ¶
func ParseTlfHandlePreferred( ctx context.Context, kbpki KBPKI, name string, public bool) ( *TlfHandle, error)
ParseTlfHandlePreferred returns TlfNameNotCanonical if not in the preferred format. Preferred format means that the users own username (from kbpki) as a writer is put before other usernames in the tlf name. i.e. Canon Preferred myname,other myname,other another,myname myname,another This function also can return NoSuchNameError or TlfNameNotCanonical. TlfNameNotCanonical is returned from this function when the name is not the *preferred* name.
func (TlfHandle) ConflictInfo ¶
func (h TlfHandle) ConflictInfo() *tlf.HandleExtension
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 []tlf.HandleExtension)
Extensions returns a list of extensions for the given handle.
func (TlfHandle) FinalizedInfo ¶
func (h TlfHandle) FinalizedInfo() *tlf.HandleExtension
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) GetPreferredFormat ¶
func (h TlfHandle) GetPreferredFormat( username libkb.NormalizedUsername) PreferredTlfName
GetPreferredFormat returns a TLF name formatted with the username given as the parameter first. This calls FavoriteNameToPreferredTLFNameFormatAs with the canonical tlf name which will be reordered into the preferred format. An empty username is allowed here and results in the canonical ordering.
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) MutuallyResolvesTo ¶
func (h TlfHandle) MutuallyResolvesTo( ctx context.Context, codec kbfscodec.Codec, resolver resolver, other TlfHandle, rev MetadataRevision, tlfID tlf.ID, log logger.Logger) error
MutuallyResolvesTo checks that the target handle, and the provided `other` handle, resolve to each other.
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 kbfscodec.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 *tlf.HandleExtension)
SetFinalizedInfo sets the handle's finalized info to the given one, which may be nil. TODO: remove this to make TlfHandle fully immutable
func (TlfHandle) ToBareHandle ¶
ToBareHandle returns a tlf.Handle corresponding to this handle.
func (TlfHandle) ToBareHandleOrBust ¶
ToBareHandleOrBust returns a tlf.Handle 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) WithUpdatedConflictInfo ¶
func (h TlfHandle) WithUpdatedConflictInfo( codec kbfscodec.Codec, info *tlf.HandleExtension) (*TlfHandle, error)
WithUpdatedConflictInfo returns a new handle with the conflict info set 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 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 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 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 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 UserDeviceKeyInfoMapV2 ¶
type UserDeviceKeyInfoMapV2 map[keybase1.UID]DeviceKeyInfoMapV2
UserDeviceKeyInfoMapV2 maps a user's keybase UID to their DeviceKeyInfoMapV2.
type UserDeviceKeyInfoMapV3 ¶
type UserDeviceKeyInfoMapV3 map[keybase1.UID]DeviceKeyInfoMapV3
UserDeviceKeyInfoMapV3 maps a user's keybase UID to their DeviceKeyInfoMapV3.
type UserDeviceKeyServerHalves ¶
type UserDeviceKeyServerHalves map[keybase1.UID]DeviceKeyServerHalves
UserDeviceKeyServerHalves maps a user's keybase UID to their DeviceServerHalves map.
type UserDevicePublicKeys ¶
type UserDevicePublicKeys map[keybase1.UID]DevicePublicKeys
UserDevicePublicKeys is a map from users to that user's set of devices.
func (UserDevicePublicKeys) Equals ¶
func (udpk UserDevicePublicKeys) Equals(other UserDevicePublicKeys) bool
Equals returns whether both sets of users are equal, and they all have corresponding equal sets of keys.
type UserInfo ¶
type UserInfo struct { Name libkb.NormalizedUsername UID keybase1.UID VerifyingKeys []kbfscrypto.VerifyingKey CryptPublicKeys []kbfscrypto.CryptPublicKey KIDNames map[keybase1.KID]string // Revoked keys, and the time at which they were revoked. RevokedVerifyingKeys map[kbfscrypto.VerifyingKey]keybase1.KeybaseTime RevokedCryptPublicKeys map[kbfscrypto.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 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 Filename string Tlf CanonicalTlfName Public bool }
WriteAccessError indicates an error when trying to write a file
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 WriteUnsupportedError ¶
type WriteUnsupportedError struct {
Filename string
}
WriteUnsupportedError indicates an error when trying to write a file
func (WriteUnsupportedError) Errno ¶
func (e WriteUnsupportedError) Errno() fuse.Errno
Errno implements the fuse.ErrorNumber interface for WriteAccessError.
func (WriteUnsupportedError) Error ¶
func (e WriteUnsupportedError) Error() string
Error implements the error interface for WriteAccessError
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( ctx context.Context, op op, original string) (string, error)
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 WriterMetadataExtraV2 ¶
type WriterMetadataExtraV2 struct { UnresolvedWriters []keybase1.SocialAssertion `codec:"uw,omitempty"` codec.UnknownFieldSetHandler }
WriterMetadataExtraV2 stores more fields for WriterMetadataV2. (See WriterMetadataV2 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 TLFWriterKeyGenerationsV2 `codec:",omitempty"` // The directory ID, signed over to make verification easier ID tlf.ID // 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 WriterMetadataExtraV2 `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 WriterMetadataExtraV2. 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.
func (*WriterMetadataV2) ToWriterMetadataV3 ¶
func (wmdV2 *WriterMetadataV2) ToWriterMetadataV3() WriterMetadataV3
ToWriterMetadataV3 converts the WriterMetadataV2 to a WriterMetadataV3.
type WriterMetadataV3 ¶
type WriterMetadataV3 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 `codec:"lmw"` // For public TLFs (since those don't have any keys at all). Writers []keybase1.UID `codec:",omitempty"` // Writers identified by unresolved social assertions. UnresolvedWriters []keybase1.SocialAssertion `codec:"uw,omitempty"` // Pointer to the writer key bundle for private TLFs. WKeyBundleID TLFWriterKeyBundleID `codec:"wkid,omitempty"` // Latest key generation. LatestKeyGen KeyGen `codec:"lkg"` // The directory ID, signed over to make verification easier ID tlf.ID // 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 codec.UnknownFieldSetHandler }
WriterMetadataV3 stores the metadata for a TLF that is only editable by users with writer permissions.
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 ¶
- backpressure_disk_limiter.go
- bare_root_metadata.go
- bare_root_metadata_test_util.go
- bare_root_metadata_v2.go
- bare_root_metadata_v3.go
- bcache.go
- block_disk_store.go
- block_getter.go
- block_journal.go
- block_ops.go
- block_ops_constrained.go
- block_ref_map.go
- block_retrieval_heap.go
- block_retrieval_queue.go
- block_retrieval_worker.go
- block_types.go
- block_util.go
- branch_id.go
- bserver_disk.go
- bserver_error.go
- bserver_measured.go
- bserver_memory.go
- bserver_remote.go
- bsplitter_simple.go
- choosedefaultmount_nix.go
- coalescing_context.go
- config_local.go
- conflict_renamer.go
- conflict_resolver.go
- connection_status.go
- constants.go
- context.go
- cr_actions.go
- cr_chains.go
- crypto_client.go
- crypto_client_rpc.go
- crypto_common.go
- crypto_local.go
- crypto_measured.go
- data_types.go
- delayed_cancellation.go
- dir_entry.go
- dirty_bcache.go
- dirty_file.go
- disk_journal.go
- disk_limits_unix.go
- errors.go
- errors_fuse.go
- favorites.go
- file_data.go
- flag_size.go
- folder_block_manager.go
- folder_block_ops.go
- folder_branch_ops.go
- folder_branch_status.go
- identify_util.go
- init.go
- interfaces.go
- journal_block_cache.go
- journal_block_server.go
- journal_dirty_bcache.go
- journal_md_ops.go
- journal_server.go
- journal_server_util.go
- kbfs_ops.go
- kbpki_client.go
- kbpki_util.go
- kcache_measured.go
- key_bundle.go
- key_bundle_cache.go
- key_bundle_cache_measured.go
- key_bundle_v2.go
- key_bundle_v3.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
- keybase_service_util.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_config.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
- path.go
- prefetcher.go
- rekey_queue.go
- reporter_kbpki.go
- reporter_simple.go
- root_metadata.go
- rwlocker.go
- semaphore_disk_limiter.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_resolve.go
- tlf_journal.go
- unflushed_path_cache.go
- util.go
- version.go
- wall_clock.go