github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/internal/dsync/lock-args.go (about) 1 // Copyright (c) 2015-2021 MinIO, Inc. 2 // 3 // This file is part of MinIO Object Storage stack 4 // 5 // This program is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Affero General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Affero General Public License for more details. 14 // 15 // You should have received a copy of the GNU Affero General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 package dsync 19 20 //go:generate msgp -file $GOFILE 21 22 // LockArgs is minimal required values for any dsync compatible lock operation. 23 type LockArgs struct { 24 // Unique ID of lock/unlock request. 25 UID string 26 27 // Resources contains single or multiple entries to be locked/unlocked. 28 Resources []string 29 30 // Source contains the line number, function and file name of the code 31 // on the client node that requested the lock. 32 Source string 33 34 // Owner represents unique ID for this instance, an owner who originally requested 35 // the locked resource, useful primarily in figuring out stale locks. 36 Owner string 37 38 // Quorum represents the expected quorum for this lock type. 39 Quorum int 40 } 41 42 // ResponseCode is the response code for a locking request. 43 type ResponseCode uint8 44 45 // Response codes for a locking request. 46 const ( 47 RespOK ResponseCode = iota 48 RespLockConflict 49 RespLockNotInitialized 50 RespLockNotFound 51 RespErr 52 ) 53 54 // LockResp is a locking request response. 55 type LockResp struct { 56 Code ResponseCode 57 Err string 58 }