mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-29 10:41:05 -06:00
this point the compoundBlob only contains blob leafs but a future change will create multiple tiers. Both these implement the new Blob interface. The splitting is done by using a rolling hash over the last 64 bytes, when that hash ends with 13 consecutive ones we split the data. Issue #17
45 lines
630 B
Go
45 lines
630 B
Go
package types
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"github.com/attic-labs/noms/ref"
|
|
)
|
|
|
|
type String struct {
|
|
s string
|
|
ref *ref.Ref
|
|
}
|
|
|
|
func NewString(s string) String {
|
|
return String{s, &ref.Ref{}}
|
|
}
|
|
|
|
func (fs String) Blob() (Blob, error) {
|
|
return NewBlob(bytes.NewBufferString(fs.s))
|
|
}
|
|
|
|
func (fs String) String() string {
|
|
return fs.s
|
|
}
|
|
|
|
func (fs String) Ref() ref.Ref {
|
|
return ensureRef(fs.ref, fs)
|
|
}
|
|
|
|
func (fs String) Equals(other Value) bool {
|
|
if other == nil {
|
|
return false
|
|
} else {
|
|
return fs.Ref() == other.Ref()
|
|
}
|
|
}
|
|
|
|
func (fs String) Chunks() []Future {
|
|
return nil
|
|
}
|
|
|
|
func StringFromVal(v Value) String {
|
|
return v.(String)
|
|
}
|