Repository: etcd-io/etcd
File: tests/robustness/model/history.go (Go)

Code before:
}

func NewAppendableHistory(ids identity.Provider) *AppendableHistory {
	return &AppendableHistory{
		streamID:      ids.NewStreamID(),
		idProvider:    ids,
		lastOperation: make(map[int]*porcupine.Operation),
		History: History{
			operations: []porcupine.Operation{},
		},
	}
}

func (h *AppendableHistory) AppendRange(startKey, endKey string, revision, limit int64, start, end time.Duration, resp *clientv3.GetResponse, err error) {
	request := staleRangeRequest(startKey, endKey, limit, revision)
	if err != nil {
		h.appendFailed(request, start, end, err)
		return
	}
	var respRevision int64
	var respMemberID uint64
	if resp != nil && resp.Header != nil {
		respRevision = resp.Header.Revision
		respMemberID = resp.Header.MemberId
	}
	h.appendSuccessful(request, start, end, rangeResponseWithMemberID(resp.Kvs, resp.Count, respRevision, respMemberID))
}

func (h *AppendableHistory) AppendPut(key, value string, start, end time.Duration, resp *clientv3.PutResponse, err error) {
	request := putRequest(key, value)
	if err != nil {
		h.appendFailed(request, start, end, err)
		return
	}
	var revision int64
	var MemberID uint64
	if resp != nil && resp.Header != nil {
		revision = resp.Header.Revision
		MemberID = resp.Header.MemberId
	}
	h.appendSuccessful(request, start, end, putResponseWithMemberID(revision, MemberID))
}

func (h *AppendableHistory) AppendPutWithLease(key, value string, leaseID int64, start, end time.Duration, resp *clientv3.PutResponse, err error) {
	request := putWithLeaseRequest(key, value, leaseID)
	if err != nil {
		h.appendFailed(request, start, end, err)
		return
	}
	var revision int64
	var MemberID uint64

Review comment (suggestion):
```suggestion
	h.appendSuccessful(request, start, end, rangeResponseWithMemberID(resp.Kvs, resp.Count, respRevision, respMemberID))
```

Code after:
}

func NewAppendableHistory(ids identity.Provider) *AppendableHistory {
	return &AppendableHistory{
		streamID:      ids.NewStreamID(),
		idProvider:    ids,
		lastOperation: make(map[int]*porcupine.Operation),
		History: History{
			operations: []porcupine.Operation{},
		},
	}
}

func (h *AppendableHistory) AppendRange(startKey, endKey string, revision, limit int64, start, end time.Duration, resp *clientv3.GetResponse, err error) {
	request := staleRangeRequest(startKey, endKey, limit, revision)
	if err != nil {
		h.appendFailed(request, start, end, err)
		return
	}
	var respRevision int64
	var respMemberID uint64
	if resp != nil && resp.Header != nil {
		respRevision = resp.Header.Revision
		respMemberID = resp.Header.MemberId
	}
	h.appendSuccessful(request, start, end, rangeResponseWithMemberID(resp.Kvs, resp.Count, respRevision, MemberID(respMemberID)))
}

func (h *AppendableHistory) AppendPut(key, value string, start, end time.Duration, resp *clientv3.PutResponse, err error) {
	request := putRequest(key, value)
	if err != nil {
		h.appendFailed(request, start, end, err)
		return
	}
	var revision int64
	var memberID MemberID
	if resp != nil && resp.Header != nil {
		revision = resp.Header.Revision
		memberID = MemberID(resp.Header.MemberId)
	}
	h.appendSuccessful(request, start, end, putResponseWithMemberID(revision, memberID))
}

func (h *AppendableHistory) AppendPutWithLease(key, value string, leaseID int64, start, end time.Duration, resp *clientv3.PutResponse, err error) {
	request := putWithLeaseRequest(key, value, leaseID)
	if err != nil {
		h.appendFailed(request, start, end, err)
		return
	}
	var revision int64
	var memberID MemberID