forked from ryyst/kalzu-value-store
Trying to add _ls and _tree subcalls to item paths..
This commit is contained in:
@@ -52,6 +52,27 @@ func (s *Server) setupRoutes() *mux.Router {
|
||||
)(s.updateResourceMetadataHandler)).Methods("PUT")
|
||||
}
|
||||
|
||||
// Key listing endpoints (read-only, leverage Merkle tree)
|
||||
if s.config.ClusteringEnabled { // Require Merkle for efficiency
|
||||
// _ls endpoint - require read if auth enabled and not anonymous
|
||||
if s.config.AuthEnabled && !s.config.AllowAnonymousRead {
|
||||
router.Handle("/kv/{path:.+}/_ls", s.authService.Middleware(
|
||||
[]string{"read"}, nil, "",
|
||||
)(s.getKeyListHandler)).Methods("GET")
|
||||
} else {
|
||||
router.HandleFunc("/kv/{path:.+}/_ls", s.getKeyListHandler).Methods("GET")
|
||||
}
|
||||
|
||||
// _tree endpoint - same auth rules
|
||||
if s.config.AuthEnabled && !s.config.AllowAnonymousRead {
|
||||
router.Handle("/kv/{path:.+}/_tree", s.authService.Middleware(
|
||||
[]string{"read"}, nil, "",
|
||||
)(s.getKeyTreeHandler)).Methods("GET")
|
||||
} else {
|
||||
router.HandleFunc("/kv/{path:.+}/_tree", s.getKeyTreeHandler).Methods("GET")
|
||||
}
|
||||
}
|
||||
|
||||
// Member endpoints (available when clustering is enabled)
|
||||
if s.config.ClusteringEnabled {
|
||||
router.HandleFunc("/members/", s.getMembersHandler).Methods("GET")
|
||||
|
Reference in New Issue
Block a user