func()

in pkg/client/store.go [65:84]


func (c *storeClient) BeginTx(ctx context.Context, write bool) (StoreTxClient, error) {
	txType := proto.StoreTxType_READ_ONLY
	if write {
		txType = proto.StoreTxType_READ_WRITE
	}
	res, err := c.client.storeClient.BeginTx(ctx, &proto.StoreBeginTxRequest{
		Token:    c.client.token,
		UnitId:   c.unitID,
		UnitType: proto.UnitType(c.unitType),
		Type:     txType,
	})
	if err != nil {
		return nil, err
	}
	return &storeClientTx{
		client: c,
		txID:   res.Id,
		write:  write,
	}, nil
}