github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/libkbfs/mdserver_local_config.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/idutil"
     9  	"github.com/keybase/client/go/kbfs/kbfscodec"
    10  	"github.com/keybase/client/go/kbfs/kbfsmd"
    11  )
    12  
    13  // mdServerLocalConfig is the subset of the Config interface needed by
    14  // the local MDServer implementations (for ease of testing).
    15  type mdServerLocalConfig interface {
    16  	Clock() Clock
    17  	Codec() kbfscodec.Codec
    18  	currentSessionGetter() idutil.CurrentSessionGetter
    19  	MetadataVersion() kbfsmd.MetadataVer
    20  	logMaker
    21  	cryptoPureGetter
    22  	teamMembershipChecker() kbfsmd.TeamMembershipChecker
    23  }
    24  
    25  // mdServerLocalConfigWrapper is an adapter for Config objects to the
    26  // mdServerLocalConfig interface.
    27  type mdServerLocalConfigAdapter struct {
    28  	Config
    29  }
    30  
    31  func (ca mdServerLocalConfigAdapter) currentSessionGetter() idutil.CurrentSessionGetter {
    32  	return ca.Config.KBPKI()
    33  }
    34  
    35  func (ca mdServerLocalConfigAdapter) teamMembershipChecker() kbfsmd.TeamMembershipChecker {
    36  	return ca.Config.KBPKI()
    37  }