functional/rpcpb/member.go
func (m *Member) CheckCompact(rev int64) error {
	cli, err := m.CreateEtcdClient()
	if err != nil {
		return fmt.Errorf("%v (%q)", err, m.EtcdClientEndpoint)
	}
	defer cli.Close()

	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	wch := cli.Watch(ctx, "\x00", clientv3.WithFromKey(), clientv3.WithRev(rev-1))
	wr, ok := <-wch
	cancel()

	if !ok {
		return fmt.Errorf("watch channel terminated (endpoint %q)", m.EtcdClientEndpoint)
	}
	if wr.CompactRevision != rev {
		return fmt.Errorf("got compact revision %v, wanted %v (endpoint %q)", wr.CompactRevision, rev, m.EtcdClientEndpoint)
	}

	return nil
}
func (m *Member) CheckCompact(rev int64) error {
	cli, err := m.CreateEtcdClient()
	if err != nil {
		return fmt.Errorf("%v (%q)", err, m.EtcdClientEndpoint)
	}
	defer cli.Close()

	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	wch := cli.Watch(ctx, "\x00", clientv3.WithFromKey(), clientv3.WithRev(rev-1))
	wr, ok := <-wch
	cancel()

	if !ok {
		return fmt.Errorf("watch channel terminated (endpoint %q)", m.EtcdClientEndpoint)
	}
	if wr.CompactRevision != rev {
		return fmt.Errorf("got compact revision %v, wanted %v (endpoint %q)", wr.CompactRevision, rev, m.EtcdClientEndpoint)
	}

	return nil
}
func ( m * Member ) CheckCompact ( rev int64 ) error { cli , err := m . CreateEtcdClient ( ) if err != nil { return fmt . Errorf ( " " , err , m . EtcdClientEndpoint ) } defer cli . Close ( ) ctx , cancel := context . WithTimeout ( context . Background ( ) , 5 * time . Second ) wch := cli . Watch ( ctx , " \x00 " , clientv3 . WithFromKey ( ) , clientv3 . WithRev ( rev - 1 ) ) wr , ok := <- wch cancel ( ) if ! ok { return fmt . Errorf ( " " , m . EtcdClientEndpoint ) } if wr . CompactRevision != rev { return fmt . Errorf ( " " , wr . CompactRevision , rev , m . EtcdClientEndpoint ) } return nil }
// CheckCompact ensures that historical data before given revision has been compacted.
CheckCompact ensures that historical data before given revision has been compacted .