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

Method BatchFileMeta

db/mem/mem.go:158–179  ·  view source on GitHub ↗
(_ context.Context, id db.GraphID, fIDs []db.FileID)

Source from the content-addressed store, hash-verified

156}
157
158func (d *DB) BatchFileMeta(_ context.Context, id db.GraphID, fIDs []db.FileID) (map[db.FileID]*db.FileMeta, error) {
159 g, ok := d.graphs[id]
160 if !ok {
161 return nil, db.NotExists("graph", id)
162 }
163
164 out := make(map[db.FileID]*db.FileMeta)
165 for _, fID := range fIDs {
166 mds, ok := g.metas[fID]
167 if !ok {
168 out[fID] = nil
169 continue
170 }
171 if len(mds) < 1 {
172 // Note: This indicates some sort of logic error, not client error
173 return nil, fmt.Errorf("no file metadata history found for %q", fID)
174 }
175 // Get the latest, which is the last one
176 out[fID] = mds[len(mds)-1]
177 }
178 return out, nil
179}
180
181func (d *DB) AllFileMeta(_ context.Context, id db.GraphID) ([]*db.FileMeta, error) {
182 g, ok := d.graphs[id]

Callers

nothing calls this directly

Implementers 2

DBdb/mem/mem.go
DBdb/sqlite/sqlite.go

Calls 1

NotExistsFunction · 0.92

Tested by

no test coverage detected