@@ -14,7 +14,6 @@ import (
1414 "sync"
1515 "time"
1616
17- "github.com/AlekSi/pointer"
1817 "github.com/jackc/pgtype/pgxtype"
1918 "github.com/jackc/pgx/v4"
2019 _ "github.com/lib/pq" // Register Postgres database driver.
@@ -29,7 +28,6 @@ import (
2928 "gitlab.com/postgres-ai/database-lab/v3/pkg/models"
3029 "gitlab.com/postgres-ai/database-lab/v3/pkg/util"
3130 "gitlab.com/postgres-ai/database-lab/v3/pkg/util/pglog"
32- "gitlab.com/postgres-ai/database-lab/v3/version"
3331)
3432
3533const (
@@ -46,36 +44,20 @@ type Config struct {
4644
4745// Base provides cloning service.
4846type Base struct {
49- config * Config
50- cloneMutex sync.RWMutex
51- clones map [string ]* CloneWrapper
52- instanceStatus * models.InstanceStatus
53- snapshotBox SnapshotBox
54- provision * provision.Provisioner
55- tm * telemetry.Agent
56- observingCh chan string
47+ config * Config
48+ cloneMutex sync.RWMutex
49+ clones map [string ]* CloneWrapper
50+ snapshotBox SnapshotBox
51+ provision * provision.Provisioner
52+ tm * telemetry.Agent
53+ observingCh chan string
5754}
5855
5956// NewBase instances a new Base service.
6057func NewBase (cfg * Config , provision * provision.Provisioner , tm * telemetry.Agent , observingCh chan string ) * Base {
6158 return & Base {
62- config : cfg ,
63- clones : make (map [string ]* CloneWrapper ),
64- instanceStatus : & models.InstanceStatus {
65- Status : & models.Status {
66- Code : models .StatusOK ,
67- Message : models .InstanceMessageOK ,
68- },
69- Engine : models.Engine {
70- Version : version .GetVersion (),
71- StartedAt : pointer .ToTimeOrNil (time .Now ().Truncate (time .Second )),
72- Telemetry : pointer .ToBool (tm .IsEnabled ()),
73- },
74- Cloning : models.Cloning {
75- Clones : make ([]* models.Clone , 0 ),
76- },
77- Provisioner : provision .ContainerOptions (),
78- },
59+ config : cfg ,
60+ clones : make (map [string ]* CloneWrapper ),
7961 provision : provision ,
8062 tm : tm ,
8163 observingCh : observingCh ,
@@ -88,7 +70,6 @@ func NewBase(cfg *Config, provision *provision.Provisioner, tm *telemetry.Agent,
8870// Reload reloads base cloning configuration.
8971func (c * Base ) Reload (cfg Config ) {
9072 * c .config = cfg
91- c .instanceStatus .Provisioner = c .provision .ContainerOptions ()
9273}
9374
9475// Run initializes and runs cloning component.
0 commit comments