mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-01-11 21:23:12 +01:00
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> refactor: move to a better structure Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package instance
|
|
|
|
import (
|
|
"context"
|
|
"github.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http"
|
|
"github.com/cloudnative-pg/cnpg-i/pkg/backup"
|
|
"github.com/cloudnative-pg/cnpg-i/pkg/wal"
|
|
"google.golang.org/grpc"
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
)
|
|
|
|
type CNPGI struct {
|
|
Client client.Client
|
|
BarmanObjectKey client.ObjectKey
|
|
PGDataPath string
|
|
PGWALPath string
|
|
SpoolDirectory string
|
|
}
|
|
|
|
func (c *CNPGI) Start(ctx context.Context) error {
|
|
enrich := func(server *grpc.Server) error {
|
|
wal.RegisterWALServer(server, WALServiceImplementation{
|
|
BarmanObjectKey: c.BarmanObjectKey,
|
|
Client: c.Client,
|
|
SpoolDirectory: c.SpoolDirectory,
|
|
PGDataPath: c.PGDataPath,
|
|
PGWALPath: c.PGWALPath,
|
|
})
|
|
backup.RegisterBackupServer(server, BackupServiceImplementation{})
|
|
return nil
|
|
}
|
|
|
|
srv := http.Server{
|
|
IdentityImpl: IdentityImplementation{},
|
|
Enrichers: []http.ServerEnricher{enrich},
|
|
// TODO: fille
|
|
ServerCertPath: "",
|
|
ServerKeyPath: "",
|
|
ClientCertPath: "",
|
|
ServerAddress: "",
|
|
PluginPath: "",
|
|
}
|
|
|
|
return srv.Start(ctx)
|
|
}
|