Trying to add _ls and _tree subcalls to item paths..

This commit is contained in:
Kalzu Rekku
2025-09-29 21:14:03 +03:00
parent 32b347f1fd
commit d5a0eb7efe
5 changed files with 387 additions and 59 deletions

View File

@@ -232,6 +232,38 @@ type MerkleTreeDiffResponse struct {
Keys []string `json:"keys,omitempty"` // Actual keys if this is a leaf-level diff
}
// KeyListResponse is the response for _ls endpoint
type KeyListResponse struct {
Path string `json:"path"`
Children []struct {
Subkey string `json:"subkey"`
Timestamp int64 `json:"timestamp,omitempty"`
} `json:"children"`
Total int `json:"total"`
Truncated bool `json:"truncated"`
}
// KeyTreeResponse is the response for _tree endpoint
type KeyTreeResponse struct {
Path string `json:"path"`
Children []interface{} `json:"children"` // Mixed: either KeyTreeNode or KeyListItem for leaves
Total int `json:"total"`
Truncated bool `json:"truncated"`
}
// KeyTreeNode represents a node in the tree
type KeyTreeNode struct {
Subkey string `json:"subkey"`
Timestamp int64 `json:"timestamp,omitempty"`
Children []interface{} `json:"children,omitempty"`
}
// KeyListItem represents a leaf in the tree (without children)
type KeyListItem struct {
Subkey string `json:"subkey"`
Timestamp int64 `json:"timestamp,omitempty"`
}
// For fetching a range of KV pairs
type KVRangeRequest struct {
StartKey string `json:"start_key"`
@@ -294,4 +326,7 @@ type Config struct {
// Anonymous access control (Issue #5)
AllowAnonymousRead bool `yaml:"allow_anonymous_read"` // Allow unauthenticated read access to KV endpoints
AllowAnonymousWrite bool `yaml:"allow_anonymous_write"` // Allow unauthenticated write access to KV endpoints
// Key listing configuration
KeyListingEnabled bool `yaml:"key_listing_enabled"` // Enable/disable hierarchical key listing
}