@@ -30,15 +30,13 @@ import (
3030
3131 "github.com/instill-ai/pipeline-backend/config"
3232 "github.com/instill-ai/pipeline-backend/pkg/acl"
33- "github.com/instill-ai/pipeline-backend/pkg/external"
3433 "github.com/instill-ai/pipeline-backend/pkg/handler"
3534 "github.com/instill-ai/pipeline-backend/pkg/memory"
3635 "github.com/instill-ai/pipeline-backend/pkg/middleware"
3736 "github.com/instill-ai/pipeline-backend/pkg/pubsub"
3837 "github.com/instill-ai/pipeline-backend/pkg/repository"
3938 "github.com/instill-ai/pipeline-backend/pkg/service"
4039 "github.com/instill-ai/pipeline-backend/pkg/usage"
41- "github.com/instill-ai/x/temporal"
4240
4341 componentstore "github.com/instill-ai/pipeline-backend/pkg/component/store"
4442 database "github.com/instill-ai/pipeline-backend/pkg/db"
@@ -53,6 +51,7 @@ import (
5351 otelx "github.com/instill-ai/x/otel"
5452 servergrpcx "github.com/instill-ai/x/server/grpc"
5553 gatewayx "github.com/instill-ai/x/server/grpc/gateway"
54+ temporalx "github.com/instill-ai/x/temporal"
5655)
5756
5857const gracefulShutdownWaitPeriod = 15 * time .Second
@@ -120,16 +119,28 @@ func main() {
120119 // Initialize all clients
121120 pipelinePublicServiceClient , mgmtPublicServiceClient , mgmtPrivateServiceClient ,
122121 artifactPublicServiceClient , artifactPrivateServiceClient , redisClient , db ,
123- minIOClient , minIOFileGetter , aclClient , temporalClient , closeClients := newClients (ctx , logger )
122+ aclClient , temporalClient , closeClients := newClients (ctx , logger )
124123 defer closeClients ()
125124
126- // Keep NewArtifactBinaryFetcher as requested
127- binaryFetcher := external .NewArtifactBinaryFetcher (artifactPrivateServiceClient , minIOFileGetter )
125+ // Initialize MinIO client
126+ minIOParams := miniox.ClientParams {
127+ Config : config .Config .Minio ,
128+ Logger : logger ,
129+ ExpiryRules : service .NewRetentionHandler ().ListExpiryRules (),
130+ AppInfo : miniox.AppInfo {
131+ Name : serviceName ,
132+ Version : serviceVersion ,
133+ },
134+ }
135+
136+ minIOClient , err := miniox .NewMinIOClientAndInitBucket (ctx , minIOParams )
137+ if err != nil {
138+ logger .Fatal ("failed to create MinIO client" , zap .Error (err ))
139+ }
128140
129141 compStore := componentstore .Init (componentstore.InitParams {
130142 Logger : logger ,
131143 Secrets : config .Config .Component .Secrets ,
132- BinaryFetcher : binaryFetcher ,
133144 TemporalClient : temporalClient ,
134145 })
135146
@@ -156,7 +167,7 @@ func main() {
156167 compStore ,
157168 ms ,
158169 service .NewRetentionHandler (),
159- binaryFetcher ,
170+ compStore . GetBinaryFetcher () ,
160171 artifactPublicServiceClient ,
161172 artifactPrivateServiceClient ,
162173 )
@@ -368,8 +379,6 @@ func newClients(ctx context.Context, logger *zap.Logger) (
368379 artifactpb.ArtifactPrivateServiceClient ,
369380 * redis.Client ,
370381 * gorm.DB ,
371- miniox.Client ,
372- * miniox.FileGetter ,
373382 acl.ACLClient ,
374383 temporalclient.Client ,
375384 func (),
@@ -437,7 +446,7 @@ func newClients(ctx context.Context, logger *zap.Logger) (
437446 }
438447
439448 // Initialize Temporal client
440- temporalClientOptions , err := temporal .ClientOptions (config .Config .Temporal , logger )
449+ temporalClientOptions , err := temporalx .ClientOptions (config .Config .Temporal , logger )
441450 if err != nil {
442451 logger .Fatal ("Unable to build Temporal client options" , zap .Error (err ))
443452 }
@@ -484,27 +493,6 @@ func newClients(ctx context.Context, logger *zap.Logger) (
484493
485494 aclClient := acl .NewACLClient (fgaClient , fgaReplicaClient , redisClient )
486495
487- // Initialize MinIO client
488- minIOParams := miniox.ClientParams {
489- Config : config .Config .Minio ,
490- Logger : logger ,
491- AppInfo : miniox.AppInfo {
492- Name : serviceName ,
493- Version : serviceVersion ,
494- },
495- }
496- minIOFileGetter , err := miniox .NewFileGetter (minIOParams )
497- if err != nil {
498- logger .Fatal ("Failed to create MinIO file getter" , zap .Error (err ))
499- }
500-
501- retentionHandler := service .NewRetentionHandler ()
502- minIOParams .ExpiryRules = retentionHandler .ListExpiryRules ()
503- minIOClient , err := miniox .NewMinIOClientAndInitBucket (ctx , minIOParams )
504- if err != nil {
505- logger .Fatal ("failed to create MinIO client" , zap .Error (err ))
506- }
507-
508496 closer := func () {
509497 for conn , fn := range closeFuncs {
510498 if err := fn (); err != nil {
@@ -515,5 +503,5 @@ func newClients(ctx context.Context, logger *zap.Logger) (
515503
516504 return pipelinePublicServiceClient , mgmtPublicServiceClient , mgmtPrivateServiceClient ,
517505 artifactPublicServiceClient , artifactPrivateServiceClient , redisClient , db ,
518- minIOClient , minIOFileGetter , aclClient , temporalClient , closer
506+ aclClient , temporalClient , closer
519507}
0 commit comments