MCPcopy
hub / github.com/safing/portmaster / Query

Method Query

spn/navigator/database.go:70–91  ·  view source on GitHub ↗

Query returns a an iterator for the supplied query.

(q *query.Query, local, internal bool)

Source from the content-addressed store, hash-verified

68
69// Query returns a an iterator for the supplied query.
70func (s *StorageInterface) Query(q *query.Query, local, internal bool) (*iterator.Iterator, error) {
71 // Parse key and check if valid.
72 mapName, _ := parseDBKey(q.DatabaseKeyPrefix())
73 if mapName == "" {
74 return nil, storage.ErrNotFound
75 }
76
77 // Get map.
78 m, ok := getMapForAPI(mapName)
79 if !ok {
80 return nil, storage.ErrNotFound
81 }
82
83 // Start query worker.
84 it := iterator.New()
85 module.mgr.Go("map query", func(_ *mgr.WorkerCtx) error {
86 s.processQuery(m, q, it)
87 return nil
88 })
89
90 return it, nil
91}
92
93func (s *StorageInterface) processQuery(m *Map, q *query.Query, it *iterator.Iterator) {
94 // Return all matching pins.

Callers

nothing calls this directly

Calls 6

processQueryMethod · 0.95
NewFunction · 0.92
getMapForAPIFunction · 0.85
DatabaseKeyPrefixMethod · 0.80
parseDBKeyFunction · 0.70
GoMethod · 0.45

Tested by

no test coverage detected