-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ReshiAdavan/Sentinel-10
Sentinel-10: kvraft comment thru
- Loading branch information
Showing
4 changed files
with
103 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,39 @@ | ||
package raftkv | ||
|
||
// Constants defining possible error states. | ||
const ( | ||
OK = "OK" | ||
ErrNoKey = "ErrNoKey" | ||
OK = "OK" // Indicates successful operation. | ||
ErrNoKey = "ErrNoKey" // Indicates that the requested key does not exist in the key-value store. | ||
) | ||
|
||
// Err is a custom type representing an error string. | ||
type Err string | ||
|
||
// Put or Append | ||
// PutAppendArgs defines the arguments structure for Put and Append operations. | ||
type PutAppendArgs struct { | ||
Key string | ||
Value string | ||
Command string // "Put" or "Append" | ||
ClientId int64 | ||
RequestId int64 | ||
Key string // Key in the key-value store. | ||
Value string // Value to be associated with the key. | ||
Command string // Operation type: "Put" or "Append". | ||
ClientId int64 // Unique client identifier to differentiate requests. | ||
RequestId int64 // Unique request identifier for idempotency. | ||
} | ||
|
||
// PutAppendReply defines the reply structure for Put and Append operations. | ||
type PutAppendReply struct { | ||
WrongLeader bool | ||
Err Err | ||
WrongLeader bool // Flag to indicate if the operation reached a non-leader server. | ||
Err Err // Error status of the operation. | ||
} | ||
|
||
// GetArgs defines the arguments structure for Get operation. | ||
type GetArgs struct { | ||
Key string | ||
ClientId int64 | ||
RequestId int64 | ||
Key string // Key to retrieve from the key-value store. | ||
ClientId int64 // Unique client identifier. | ||
RequestId int64 // Unique request identifier. | ||
} | ||
|
||
// GetReply defines the reply structure for Get operation. | ||
type GetReply struct { | ||
WrongLeader bool | ||
Err Err | ||
Value string | ||
WrongLeader bool // Flag to indicate if the operation reached a non-leader server. | ||
Err Err // Error status of the operation. | ||
Value string // The value retrieved for the key, if any. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.