You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: id_impl.go
    path of file: ./repos/incubator-horaedb/horaemeta/server/id
    
    the code of the file until where you have to start completion: /*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 
    
func (a *AllocatorImpl) doRebaseLocked(ctx context.Context, currEnd uint64) error {
	if currEnd < a.base {
		return ErrAllocID.WithCausef("ID in storage can't less than memory, base:%d, end:%d", a.base, currEnd)
	}

	newEnd := currEnd + uint64(a.allocStep)

	endEquals := clientv3.Compare(clientv3.Value(a.key), "=", encodeID(currEnd))
	opPutEnd := clientv3.OpPut(a.key, encodeID(newEnd))

	resp, err := a.kv.Txn(ctx).
		If(endEquals).
		Then(opPutEnd).
		Commit()
	if err != nil {
		return errors.WithMessagef(err, "put end id failed, key:%s, old value:%d, new value:%d", a.key, currEnd, newEnd)
	} else if !resp.Succeeded {
		return ErrTxnPutEndID.WithCausef("txn put end id failed, endEquals failed, key:%s, value:%d, resp:%v", a.key, currEnd, resp)
	}

	a.base = currEnd
	a.end = newEnd

	a.logger.Info("Allocator allocates a new base id", zap.String("key", a.key), zap.Uint64("id", a.base))

	return nil
}