############## NodeLocker ##############
(id string)
| 65 | // ############## NodeLocker ############## |
| 66 | |
| 67 | func NewNodeLock(id string) (n *NodeLock) { |
| 68 | if lockDebug { |
| 69 | fmt.Printf("locker.NewNodeLock gid=%d node=%s\n", getGID(), id) |
| 70 | } |
| 71 | n = &NodeLock{ |
| 72 | Id: id, |
| 73 | IsLocked: false, |
| 74 | Updated: time.Now(), |
| 75 | writeLock: make(chan int, 1), |
| 76 | } |
| 77 | n.writeLock <- 1 // Put the initial value into the channel |
| 78 | return |
| 79 | } |
| 80 | |
| 81 | type NodeLock struct { |
| 82 | Id string `bson:"-" json:"id"` |