MCPcopy Create free account
hub / github.com/bcspragu/logseq-sync / listGraphs

Method listGraphs

cmd/server/main.go:478–502  ·  view source on GitHub ↗
(ctx context.Context, req *listGraphsRequest)

Source from the content-addressed store, hash-verified

476}
477
478func (s *server) listGraphs(ctx context.Context, req *listGraphsRequest) (*listGraphsResponse, error) {
479 graphs, err := s.db.Graphs(ctx)
480 if err != nil {
481 return nil, httperr.Internal("failed to load graphs: %w", err)
482 }
483
484 var out []listGraphsResponseGraph
485 for _, g := range graphs {
486 out = append(out, listGraphsResponseGraph{
487 GraphStorageLimit: 2 << 32, // A few GB
488 GraphName: g.Name,
489 GraphUUID: string(g.ID),
490 // TODO: There's a bunch of ways we could actually return this accurately if it
491 // matters. In no particular order:
492 // 1. We store this info in FileMeta.Size, we could just sum that up (maybe as a DB method for efficient SQL implementations)
493 // 2. We could keep a running tally every time /update_files is called
494 // - Less good because of the potential to get out of sync.
495 // 3. We could query our blob store for the aggregate size of everything under a prefix.
496 GraphStorageUsage: 123456,
497 })
498 }
499 return &listGraphsResponse{
500 Graphs: out,
501 }, nil
502}
503
504type createGraphRequest struct {
505 GraphName string `json:"GraphName"`

Callers

nothing calls this directly

Calls 2

InternalFunction · 0.92
GraphsMethod · 0.65

Tested by

no test coverage detected