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

     1  // Copyright 2019 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 tlfhandle
     6  
     7  import (
     8  	"context"
     9  
    10  	"github.com/keybase/client/go/kbfs/tlf"
    11  )
    12  
    13  // ConstIDGetter is an IDGetter that always returns the same TLF ID.
    14  type ConstIDGetter struct {
    15  	ID tlf.ID
    16  }
    17  
    18  var _ IDGetter = ConstIDGetter{}
    19  
    20  // GetIDForHandle implements the IDGetter interface for ConstIDGetter.
    21  func (c ConstIDGetter) GetIDForHandle(_ context.Context, _ *Handle) (
    22  	tlf.ID, error) {
    23  	return c.ID, nil
    24  }
    25  
    26  // ValidateLatestHandleNotFinal implements the IDGetter interface for
    27  // ConstIDGetter.
    28  func (c ConstIDGetter) ValidateLatestHandleNotFinal(
    29  	_ context.Context, _ *Handle) (bool, error) {
    30  	return true, nil
    31  }