MCPcopy
hub / github.com/dosco/graphjin / resolveDatabaseRootRemotes

Method resolveDatabaseRootRemotes

core/database_join.go:891–921  ·  view source on GitHub ↗
(
	ctx context.Context,
	dbName string,
	qc *qcode.QCode,
	data []byte,
)

Source from the content-addressed store, hash-verified

889}
890
891func (s *gstate) resolveDatabaseRootRemotes(
892 ctx context.Context,
893 dbName string,
894 qc *qcode.QCode,
895 data []byte,
896) (json.RawMessage, error) {
897 if qc == nil || qc.Remotes == 0 || len(data) == 0 {
898 return json.RawMessage(data), nil
899 }
900
901 sub := gstate{
902 gj: s.gj,
903 r: cloneGraphqlReq(s.r),
904 cs: &cstate{st: stmt{qc: qc}},
905 data: injectRemoteMarkers(data, qc),
906 role: s.role,
907 database: dbName,
908 skipCache: s.skipCache,
909 }
910 err := sub.execRemoteJoin(ctx)
911 if hits := sub.fragmentHits.Load(); hits != 0 {
912 s.fragmentHits.Add(hits)
913 }
914 if misses := sub.fragmentMisses.Load(); misses != 0 {
915 s.fragmentMisses.Add(misses)
916 }
917 if err != nil {
918 return nil, err
919 }
920 return json.RawMessage(sub.data), nil
921}

Callers 1

Calls 3

execRemoteJoinMethod · 0.95
cloneGraphqlReqFunction · 0.85
injectRemoteMarkersFunction · 0.85

Tested by

no test coverage detected