-
Notifications
You must be signed in to change notification settings - Fork 1
updated HasResolveCustomSource PR for latest branch #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: metadata-separation-multi-source
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,7 @@ import Hasura.GraphQL.Transport.HTTP.Protocol (toParsed) | |
| import Hasura.Logging | ||
| import Hasura.Prelude | ||
| import Hasura.RQL.DDL.Schema.Cache | ||
| import Hasura.RQL.DDL.Schema.Source | ||
| import Hasura.RQL.Types | ||
| import Hasura.RQL.Types.Run | ||
| import Hasura.Server.API.Query | ||
|
|
@@ -228,7 +229,7 @@ initialiseCtx env (HGEOptionsG rci metadataDbUrl hgeCmd) = do | |
| migrateCatalogSchema logger pgLogger env connParams rci metadataDbUrl | ||
|
|
||
| schemaCacheE <- runExceptT | ||
| $ peelMetadataRun (RunCtx adminUserInfo httpManager sqlGenCtx) metadata | ||
| $ peelMetadataRun (RunCtx adminUserInfo httpManager sqlGenCtx {- TODO: -} defaultResolveCustomSource) metadata | ||
| $ buildRebuildableSchemaCache env | ||
|
|
||
| schemaCache <- fmap fst $ onLeft schemaCacheE $ \err -> do | ||
|
|
@@ -326,6 +327,7 @@ runHGEServer | |
| , Tracing.HasReporter m | ||
| , MonadQueryInstrumentation m | ||
| , MonadMetadataStorage m | ||
| , HasResolveCustomSource m | ||
| ) | ||
| => Env.Environment | ||
| -> ServeOptions impl | ||
|
|
@@ -357,6 +359,8 @@ runHGEServer env ServeOptions{..} InitCtx{..} _ initTime | |
| Loggers loggerCtx logger _ = _icLoggers | ||
| SchemaSyncCtx schemaSyncListenerThread schemaSyncEventRef = schemaSyncCtx | ||
|
|
||
| srcResolver <- askResolveCustomSource | ||
|
|
||
| authModeRes <- runExceptT $ setupAuthMode soAdminSecret soAuthHook soJwtSecret soUnAuthRole | ||
| _icHttpManager logger | ||
|
|
||
|
|
@@ -393,7 +397,7 @@ runHGEServer env ServeOptions{..} InitCtx{..} _ initTime | |
|
|
||
| -- start background thread for schema sync event processing | ||
| schemaSyncProcessorThread <- | ||
| startSchemaSyncProcessorThread sqlGenCtx | ||
| startSchemaSyncProcessorThread sqlGenCtx srcResolver | ||
| logger _icHttpManager schemaSyncEventRef cacheRef _icInstanceId | ||
|
|
||
| let | ||
|
|
@@ -631,7 +635,7 @@ runAsAdmin | |
| -> m (Either QErr a) | ||
| runAsAdmin sqlGenCtx httpManager metadata m = | ||
| fmap (fmap fst) $ runExceptT $ | ||
| peelMetadataRun (RunCtx adminUserInfo httpManager sqlGenCtx) metadata m | ||
| peelMetadataRun (RunCtx adminUserInfo httpManager sqlGenCtx {- TODO: -} defaultResolveCustomSource) metadata m | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here too we can use the default one. |
||
|
|
||
| execQuery | ||
| :: ( HasVersion | ||
|
|
@@ -646,7 +650,7 @@ execQuery env httpManager metadata queryBs = runExceptT do | |
| QueryWithSource source query <- case A.decode queryBs of | ||
| Just jVal -> decodeValue jVal | ||
| Nothing -> throw400 InvalidJSON "invalid json" | ||
| let runCtx = RunCtx adminUserInfo httpManager (SQLGenCtx False) | ||
| let runCtx = RunCtx adminUserInfo httpManager (SQLGenCtx False) {- TODO: -} defaultResolveCustomSource | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here too we can use the default one. |
||
| actionM = do | ||
| buildSchemaCacheStrict noMetadataModify | ||
| encJToLBS <$> runQueryM env source query | ||
|
|
@@ -667,6 +671,9 @@ execQuery env httpManager metadata queryBs = runExceptT do | |
|
|
||
| instance Tracing.HasReporter ServerAppM | ||
|
|
||
| instance HasResolveCustomSource ServerAppM where | ||
| askResolveCustomSource = pure defaultResolveCustomSource | ||
|
|
||
| instance MonadQueryInstrumentation ServerAppM where | ||
| askInstrumentQuery _ = pure (id, noProfile) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,8 @@ runClearMetadata _ = do | |
| Nothing -> emptyMetadata | ||
| Just defaultSourceMetadata -> | ||
| let emptyDefaultSource = SourceMetadata defaultSource mempty mempty | ||
| $ _smConfiguration defaultSourceMetadata | ||
| (_smConfiguration defaultSourceMetadata) | ||
| (_smReplicas defaultSourceMetadata) | ||
| in emptyMetadata | ||
| & metaSources %~ HM.insert defaultSource emptyDefaultSource | ||
| pure successMsg | ||
|
|
@@ -405,7 +406,7 @@ fetchMetadataFromHdbTables defaultSourceConfig = liftTx do | |
|
|
||
| let tableMetadatas = mapFromL _tmTable $ HM.elems postRelMap | ||
| sources = HM.singleton defaultSource $ | ||
| SourceMetadata defaultSource tableMetadatas functions defaultSourceConfig | ||
| SourceMetadata defaultSource tableMetadatas functions defaultSourceConfig [] {- TODO: not sure what to do here -} | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do think there's no notion of |
||
| pure $ Metadata sources remoteSchemas collections | ||
| allowlist customTypes actions cronTriggers | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we initialize and build the
RebuildableSchemaCachefor the OSS server. No other customization exist (via type classes). We can use default here for OSS.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this also where we build the cache for Pro then? So wouldn't we need to add the type class here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or do you mean it's just the connection used to read the Postgres metadata? I guess what I'm asking is - will the
ResolvedSources be stored in the schema cache?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this. If yes, then we should add the type class here too.