github.com/swiftstack/ProxyFS@v0.0.0-20210203235616-4017c267d62f/dlm/config.go (about)

     1  // Copyright (c) 2015-2021, NVIDIA CORPORATION.
     2  // SPDX-License-Identifier: Apache-2.0
     3  
     4  package dlm
     5  
     6  // Configuration variables for DLM
     7  
     8  import (
     9  	"github.com/swiftstack/ProxyFS/conf"
    10  	"github.com/swiftstack/ProxyFS/trackedlock"
    11  	"github.com/swiftstack/ProxyFS/transitions"
    12  )
    13  
    14  type globalsStruct struct {
    15  	trackedlock.Mutex
    16  
    17  	// Map used to store locks owned locally
    18  	// NOTE: This map is protected by the Mutex
    19  	localLockMap map[string]*localLockTrack
    20  
    21  	// TODO - channels for STOP and from DLM lock master?
    22  	// is the channel lock one per lock or a global one from DLM?
    23  	// how could it be... probably just one receive thread the locks
    24  	// map, checks bit and releases lock if no one using, otherwise
    25  	// blocks until it is free...
    26  }
    27  
    28  var globals globalsStruct
    29  
    30  func init() {
    31  	transitions.Register("dlm", &globals)
    32  }
    33  
    34  func (dummy *globalsStruct) Up(confMap conf.ConfMap) (err error) {
    35  	// Create map used to store locks
    36  	globals.localLockMap = make(map[string]*localLockTrack)
    37  	return
    38  }
    39  
    40  func (dummy *globalsStruct) VolumeGroupCreated(confMap conf.ConfMap, volumeGroupName string, activePeer string, virtualIPAddr string) (err error) {
    41  	return nil
    42  }
    43  func (dummy *globalsStruct) VolumeGroupMoved(confMap conf.ConfMap, volumeGroupName string, activePeer string, virtualIPAddr string) (err error) {
    44  	return nil
    45  }
    46  func (dummy *globalsStruct) VolumeGroupDestroyed(confMap conf.ConfMap, volumeGroupName string) (err error) {
    47  	return nil
    48  }
    49  func (dummy *globalsStruct) VolumeCreated(confMap conf.ConfMap, volumeName string, volumeGroupName string) (err error) {
    50  	return nil
    51  }
    52  func (dummy *globalsStruct) VolumeMoved(confMap conf.ConfMap, volumeName string, volumeGroupName string) (err error) {
    53  	return nil
    54  }
    55  func (dummy *globalsStruct) VolumeDestroyed(confMap conf.ConfMap, volumeName string) (err error) {
    56  	return nil
    57  }
    58  func (dummy *globalsStruct) ServeVolume(confMap conf.ConfMap, volumeName string) (err error) {
    59  	return nil
    60  }
    61  func (dummy *globalsStruct) UnserveVolume(confMap conf.ConfMap, volumeName string) (err error) {
    62  	return nil
    63  }
    64  func (dummy *globalsStruct) VolumeToBeUnserved(confMap conf.ConfMap, volumeName string) (err error) {
    65  	return nil
    66  }
    67  func (dummy *globalsStruct) SignaledStart(confMap conf.ConfMap) (err error) {
    68  	return nil
    69  }
    70  func (dummy *globalsStruct) SignaledFinish(confMap conf.ConfMap) (err error) {
    71  	return nil
    72  }
    73  func (dummy *globalsStruct) Down(confMap conf.ConfMap) (err error) {
    74  	return nil
    75  }