| 49 | private final TableStats tableStats; |
| 50 | |
| 51 | public static NodeContext of(Environment environment, |
| 52 | ClusterService clusterService, |
| 53 | Functions functions, |
| 54 | Roles roles, |
| 55 | TableStats tableStats) { |
| 56 | return new NodeContext(functions, roles, nodeCtx -> { |
| 57 | var tableInfoFactory = new DocTableInfoFactory(nodeCtx); |
| 58 | BlobSchemaInfo blobSchemaInfo = new BlobSchemaInfo( |
| 59 | clusterService, |
| 60 | new BlobTableInfoFactory(environment)); |
| 61 | Map<String, SchemaInfo> systemSchemas = Map.of( |
| 62 | SysSchemaInfo.NAME, new SysSchemaInfo(clusterService, nodeCtx.roles()), |
| 63 | InformationSchemaInfo.NAME, new InformationSchemaInfo(), |
| 64 | PgCatalogSchemaInfo.NAME, new PgCatalogSchemaInfo(tableStats, nodeCtx.roles()), |
| 65 | BlobSchemaInfo.NAME, blobSchemaInfo |
| 66 | ); |
| 67 | var relationAnalyzer = new RelationAnalyzer(nodeCtx); |
| 68 | var viewInfoFactory = new ViewInfoFactory(relationAnalyzer); |
| 69 | Schemas schemas = new Schemas( |
| 70 | systemSchemas, |
| 71 | clusterService, |
| 72 | new DocSchemaInfoFactory(tableInfoFactory, viewInfoFactory), |
| 73 | nodeCtx.roles() |
| 74 | ); |
| 75 | schemas.start(); |
| 76 | return schemas; |
| 77 | }, tableStats); |
| 78 | } |
| 79 | |
| 80 | public NodeContext(Functions functions, |
| 81 | Roles roles, |