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

Method getAllFiles

cmd/server/main.go:676–705  ·  view source on GitHub ↗
(ctx context.Context, req *getAllFilesRequest)

Source from the content-addressed store, hash-verified

674}
675
676func (s *server) getAllFiles(ctx context.Context, req *getAllFilesRequest) (*getAllFilesResponse, error) {
677 gID := db.GraphID(req.GraphUUID)
678
679 // TODO: We definitely want to actually use the built in pagination here, need to figure out how the real API does it (e.g. batch size, token format, etc)
680 mds, err := s.db.AllFileMeta(ctx, gID)
681 if err != nil {
682 return nil, httperr.Internal("failed to load batch file meta: %w", err)
683 }
684
685 userID, err := s.getUserID(ctx)
686 if err != nil {
687 return nil, httperr.Unauthorized("failed to load user ID: %w", err)
688 }
689
690 out := []getAllFilesResponseObject{}
691 for _, md := range mds {
692 out = append(out, getAllFilesResponseObject{
693 Key: path.Join(string(userID), string(gID), string(md.ID)),
694 Checksum: string(md.Checksum),
695 LastModified: md.LastModifiedAt.UnixMilli(),
696 Size: md.Size,
697 Txid: int64(md.LastModifiedTX),
698 })
699 }
700
701 return &getAllFilesResponse{
702 Objects: out,
703 NextContinuationToken: "", // TODO: See above
704 }, nil
705}
706
707type getTxidRequest struct {
708 GraphUUID string `json:"GraphUUID"`

Callers

nothing calls this directly

Calls 5

getUserIDMethod · 0.95
GraphIDTypeAlias · 0.92
InternalFunction · 0.92
UnauthorizedFunction · 0.92
AllFileMetaMethod · 0.65

Tested by

no test coverage detected