Documentation
¶
Index ¶
- Constants
- func CutGroupPrefix(result string) (string, bool)
- func ExtractRequestIDFromResult(result string, resultID string) (string, error)
- func GenerateRequestKey(id int64) []byte
- func GenerateRequestKeyFromString(id string) []byte
- func GenerateResultKey(id string) []byte
- func GetFirstGroupedResultID(groupedValue string) string
- func MarshalRequest(req *Request) ([]byte, error)
- func MarshalTask(agentID agent.ID, result *proto.TaskResponse) ([]byte, error)
- type Key
- type Request
- type Task
Constants ¶
const ( ResultKeyPrefix = "res" RequestKeyPrefix = "req" )
Variables ¶
This section is empty.
Functions ¶
func CutGroupPrefix ¶
CutGroupPrefix checks if a result string represents a grouped result. Returns the grouped value (without the "grouped:" prefix) and true if it's a grouped result.
func ExtractRequestIDFromResult ¶
ExtractRequestIDFromResult determines the appropriate request ID for a given result. For grouped results, it uses the result ID directly. For individual results, it follows the groupID vs individual ID logic.
func GenerateRequestKey ¶
GenerateRequestKey creates a database key for storing task requests using an integer ID.
func GenerateRequestKeyFromString ¶
GenerateRequestKeyFromString creates a database key for storing task requests using a string ID.
func GenerateResultKey ¶
GenerateResultKey creates a database key for storing task results.
func GetFirstGroupedResultID ¶
GetFirstGroupedResultID extracts the first result ID from a grouped result value.
func MarshalRequest ¶
MarshalRequest serializes a request for database storage.
func MarshalTask ¶
MarshalTask serializes a task with its agent and result for database storage.
Types ¶
type Key ¶
func StringToKey ¶
StringToKey parses a database key string into its prefix and ID components.
type Request ¶
func UnmarshalRequest ¶
UnmarshalRequest deserializes request data from the database.