github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/nomad/volumewatcher/interfaces.go (about)

     1  package volumewatcher
     2  
     3  import (
     4  	cstructs "github.com/hashicorp/nomad/client/structs"
     5  	"github.com/hashicorp/nomad/nomad/structs"
     6  )
     7  
     8  // VolumeRaftEndpoints exposes the volume watcher to a set of functions
     9  // to apply data transforms via Raft.
    10  type VolumeRaftEndpoints interface {
    11  
    12  	// UpsertVolumeClaims applys a batch of claims to raft
    13  	UpsertVolumeClaims(*structs.CSIVolumeClaimBatchRequest) (uint64, error)
    14  }
    15  
    16  // ClientRPC is a minimal interface of the Server, intended as an aid
    17  // for testing logic surrounding server-to-server or server-to-client
    18  // RPC calls and to avoid circular references between the nomad
    19  // package and the volumewatcher
    20  type ClientRPC interface {
    21  	ControllerDetachVolume(args *cstructs.ClientCSIControllerDetachVolumeRequest, reply *cstructs.ClientCSIControllerDetachVolumeResponse) error
    22  	NodeDetachVolume(args *cstructs.ClientCSINodeDetachVolumeRequest, reply *cstructs.ClientCSINodeDetachVolumeResponse) error
    23  }
    24  
    25  // claimUpdater is the function used to update claims on behalf of a volume
    26  // (used to wrap batch updates so that we can test
    27  // volumeWatcher methods synchronously without batching)
    28  type updateClaimsFn func(claims []structs.CSIVolumeClaimRequest) (uint64, error)