зеркало из https://github.com/github/vitess-gh.git
Moving a Tablet member function out. For proto3.
This commit is contained in:
Родитель
ef1e7a908e
Коммит
d5ed9e3ce9
|
@ -82,7 +82,7 @@ func (th *tabletHealth) stream(ctx context.Context, ts topo.Server, tabletAlias
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ep, err := ti.EndPoint()
|
||||
ep, err := topo.TabletEndPoint(ti.Tablet)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ func (agent *ActionAgent) TabletExternallyReparented(ctx context.Context, extern
|
|||
// this will be enough for clients to re-resolve the new master.
|
||||
event.DispatchUpdate(ev, "writing new master endpoint")
|
||||
log.Infof("fastTabletExternallyReparented: writing new master endpoint to serving graph")
|
||||
ep, err := tablet.EndPoint()
|
||||
ep, err := topo.TabletEndPoint(tablet.Tablet)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fastTabletExternallyReparented: failed to generate EndPoint for tablet %v: %v", tablet.Alias, err)
|
||||
}
|
||||
|
|
|
@ -367,8 +367,8 @@ func (tablet *Tablet) ValidatePortmap() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// EndPoint returns an EndPoint associated with the tablet record
|
||||
func (tablet *Tablet) EndPoint() (*pb.EndPoint, error) {
|
||||
// TabletEndPoint returns an EndPoint associated with the tablet record
|
||||
func TabletEndPoint(tablet *Tablet) (*pb.EndPoint, error) {
|
||||
if err := tablet.ValidatePortmap(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -435,12 +435,6 @@ func (tablet *Tablet) IsSlaveType() bool {
|
|||
return IsSlaveType(tablet.Type)
|
||||
}
|
||||
|
||||
// IsAssigned returns if this tablet ever assigned data? A "scrap" node will
|
||||
// show up as assigned even though its data cannot be used for serving.
|
||||
func (tablet *Tablet) IsAssigned() bool {
|
||||
return tablet.Keyspace != "" && tablet.Shard != ""
|
||||
}
|
||||
|
||||
// String returns a string describing the tablet.
|
||||
func (tablet *Tablet) String() string {
|
||||
return fmt.Sprintf("Tablet{%v}", tablet.Alias)
|
||||
|
@ -457,6 +451,13 @@ type TabletInfo struct {
|
|||
*Tablet
|
||||
}
|
||||
|
||||
// IsAssigned returns if this tablet ever assigned data?
|
||||
// A "scrap" node will show up as assigned even though its data
|
||||
// cannot be used for serving.
|
||||
func (tablet *TabletInfo) IsAssigned() bool {
|
||||
return tablet.Keyspace != "" && tablet.Shard != ""
|
||||
}
|
||||
|
||||
// Version returns the version of this tablet from last time it was read or
|
||||
// updated.
|
||||
func (ti *TabletInfo) Version() int64 {
|
||||
|
|
|
@ -110,7 +110,7 @@ func rebuildCellSrvShard(ctx context.Context, log logutil.Logger, ts topo.Server
|
|||
endpoints = topo.NewEndPoints()
|
||||
serving[tablet.Type] = endpoints
|
||||
}
|
||||
entry, err := tablet.EndPoint()
|
||||
entry, err := topo.TabletEndPoint(tablet.Tablet)
|
||||
if err != nil {
|
||||
log.Warningf("EndPointForTablet failed for tablet %v: %v", tablet.Alias, err)
|
||||
continue
|
||||
|
@ -366,7 +366,7 @@ func UpdateTabletEndpoints(ctx context.Context, ts topo.Server, tablet *topo.Tab
|
|||
|
||||
// Update the list that the tablet is supposed to be in (if any).
|
||||
if tablet.IsInServingGraph() {
|
||||
endpoint, err := tablet.EndPoint()
|
||||
endpoint, err := topo.TabletEndPoint(tablet)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ func commandVtTabletExecute(ctx context.Context, wr *wrangler.Wrangler, subFlags
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ep, err := tabletInfo.EndPoint()
|
||||
ep, err := topo.TabletEndPoint(tabletInfo.Tablet)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot get EndPoint from tablet record: %v", err)
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ func commandVtTabletStreamHealth(ctx context.Context, wr *wrangler.Wrangler, sub
|
|||
return err
|
||||
}
|
||||
|
||||
ep, err := tabletInfo.EndPoint()
|
||||
ep, err := topo.TabletEndPoint(tabletInfo.Tablet)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot get EndPoint from tablet record: %v", err)
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ func NewQueryResultReaderForTablet(ctx context.Context, ts topo.Server, tabletAl
|
|||
return nil, err
|
||||
}
|
||||
|
||||
endPoint, err := tablet.EndPoint()
|
||||
endPoint, err := topo.TabletEndPoint(tablet.Tablet)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче