OleksiienkoMykyta commented on PR #1850:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1850#issuecomment-2554052613
> You still have a public `protocol` package there. Let's just move
everything that is private to the `internal` package and everything else stays
in the main `gocql` package as it exists today.
>
> So 1 single `internal` package that contains stuff that is not exported
publicly by gocql's interface today and everything else keep unchanged in the
`gocql` package.
>
> After this we can start thinking about potentially a better organization
for the code under `internal` but let's not worry about that yet. The most
useful and complex part is splitting the code between these 2 places:
"internal" (single `internal` package for now) and "public API" (`gocql`
package)
Yes, I have created the `protocol` package to have an opportunity to use
types and functions used in the `gocql` and the `internal` packages, to avoid
cycle imports, the internal doesn't have separation on sub-packages. The idea
is to move everything that should be moved to a single `internal` package and
save backward compatibility. So the public API types and functions are just
duplicated to separate packages, and marked as deprecated in the `gocql`.
I tried to gracefully separate the internal and public API and avoid cycle
importing and breaking backward compatibility.
So, if I get it in the right way, do you want me to move only functionality
that can be moved without any changes to public API (even if it's provided with
backward compatibility)?
For example:
```
func encVint(v int64) []byte {
vEnc := encIntZigZag(v)
lead0 := bits.LeadingZeros64(vEnc)
numBytes := (639 - lead0*9) >> 6
// It can be 1 or 0 is v ==0
if numBytes <= 1 {
return []byte{byte(vEnc)}
}
extraBytes := numBytes - 1
var buf = make([]byte, numBytes)
for i := extraBytes; i >= 0; i-- {
buf[i] = byte(vEnc)
vEnc >>= 8
}
buf[0] |= byte(^(0xff >> uint(extraBytes)))
return buf
}
```
Because I thought that the aim was to completely separate the `public` and
`internal` API's.
Thank you for the detailed review, I appreciate it!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]