Skip to content

Commit

Permalink
Update vschema.go
Browse files Browse the repository at this point in the history
Signed-off-by: anshikavashistha <[email protected]>
  • Loading branch information
anshikavashistha authored Feb 4, 2025
1 parent bd17b6c commit b6ff221
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions go/vt/topo/vschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,42 +328,4 @@ func (ts *Server) SaveMirrorRules(ctx context.Context, mirrorRules *vschemapb.Mi
return err
}

type VSchemaInfo struct {
keyspace string
version Version
*vschemapb.Keyspace
}

func (ts *Server) GetVSchema(ctx context.Context, keyspace string) (*VSchemaInfo, error) {
ksvs, err := ts.GetVSchema(ctx, keyspace)
if err != nil {
return nil, err
}
return &VSchemaInfo{
keyspace: ksvs.Name,
version: ksvs.version,
Keyspace: ksvs.Keyspace,
}, nil
}

func (ts *Server) SaveVSchema(ctx context.Context, keyspace string, vschema *VSchemaInfo) error {
if err := ctx.Err(); err != nil {
return err
}

nodePath := path.Join(KeyspacesPath, keyspace, VSchemaFile)
data, err := vschema.MarshalVT()
if err != nil {
return err
}

version, err := ts.globalCell.Update(ctx, nodePath, data, vschema.version)
if err != nil {
log.Errorf("failed to update vschema for keyspace %s: %v", keyspace, err)
return err
}
vschema.version = version
log.Infof("successfully updated vschema for keyspace %s: %+v", keyspace, vschema.Keyspace)

return nil
}

0 comments on commit b6ff221

Please sign in to comment.