Permalink
Browse files

Whoops, make 'noms stats' work for HTTP (#3770)

  • Loading branch information...
cmasone-attic authored and rafael-atticlabs committed Oct 20, 2017
1 parent 4d072e2 commit ac79d4f87c8c78e1a4f346176d75273e9f8f8a24
Showing with 13 additions and 1 deletion.
  1. +1 −1 cmd/noms/noms_stats.go
  2. +5 −0 go/datas/database.go
  3. +4 −0 go/datas/database_common.go
  4. +3 −0 go/datas/database_server.go
View
@@ -20,7 +20,7 @@ func nomsStats(noms *kingpin.Application) (*kingpin.CmdClause, util.KingpinHandl
return stats, func(input string) int {
cfg := config.NewResolver()
store, err := cfg.GetChunkStore(*database)
store, err := cfg.GetDatabase(*database)
d.CheckError(err)
defer store.Close()
View
@@ -104,6 +104,11 @@ type Database interface {
// implementation-dependent, and impls may return nil
Stats() interface{}
// StatsSummary may return a string containing summarized statistics for
// the ChunkStore that backs this Database. It must return "Unsupported"
// if this operation is not supported.
StatsSummary() string
// chunkStore returns the ChunkStore used to read and write
// groups of values to the database efficiently. This interface is a low-
// level detail of the database that should infrequently be needed by
@@ -51,6 +51,10 @@ func (db *database) Stats() interface{} {
return db.ChunkStore().Stats()
}
func (db *database) StatsSummary() string {
return db.ChunkStore().StatsSummary()
}
func (db *database) Datasets() types.Map {
rootHash := db.rt.Root()
if rootHash.IsEmpty() {
@@ -77,6 +77,9 @@ func (s *RemoteDatabaseServer) Run() {
router.POST(constants.GraphQLPath, s.corsHandle(s.makeHandle(HandleGraphQL)))
router.OPTIONS(constants.GraphQLPath, s.corsHandle(noopHandle))
router.GET(constants.StatsPath, s.corsHandle(s.makeHandle(HandleStats)))
router.OPTIONS(constants.StatsPath, s.corsHandle(noopHandle))
srv := &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
router.ServeHTTP(w, req)

0 comments on commit ac79d4f

Please sign in to comment.