github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/libkbfs/journal_block_cache.go (about)

     1  // Copyright 2016 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package libkbfs
     6  
     7  import (
     8  	"github.com/keybase/client/go/kbfs/data"
     9  	"github.com/keybase/client/go/kbfs/tlf"
    10  )
    11  
    12  type journalBlockCache struct {
    13  	jManager *JournalManager
    14  	data.BlockCache
    15  }
    16  
    17  var _ data.BlockCache = journalBlockCache{}
    18  
    19  // CheckForKnownPtr implements BlockCache.
    20  func (j journalBlockCache) CheckForKnownPtr(
    21  	tlfID tlf.ID, block *data.FileBlock,
    22  	hashBehavior data.BlockCacheHashBehavior) (data.BlockPointer, error) {
    23  	_, ok := j.jManager.getTLFJournal(tlfID, nil)
    24  	if !ok {
    25  		return j.BlockCache.CheckForKnownPtr(tlfID, block, hashBehavior)
    26  	}
    27  
    28  	// Temporarily disable de-duping for the journal server until
    29  	// KBFS-1149 is fixed. (See also
    30  	// journalBlockServer.AddReference.)
    31  	return data.BlockPointer{}, nil
    32  }