mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
finish removing traces of ingest API
A couple of helper functions and types were left over from the ingest API. Thanks, staticcheck!
This commit is contained in:
parent
7b434cd11c
commit
0c904b3fae
3 changed files with 0 additions and 96 deletions
17
api.go
17
api.go
|
|
@ -1750,23 +1750,6 @@ func importExistenceColumns(qcx *Qcx, index *Index, columnIDs []uint64, shard ui
|
|||
return ef.Import(qcx, existenceRowIDs, columnCopy, nil, shard, &options)
|
||||
}
|
||||
|
||||
func clearExistenceColumns(tx Tx, index *Index, columnIDs []uint64, shard uint64) error {
|
||||
ef := index.existenceField()
|
||||
if ef == nil {
|
||||
return nil
|
||||
}
|
||||
v := ef.view("standard")
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
f := v.Fragment(shard)
|
||||
if f == nil {
|
||||
return nil
|
||||
}
|
||||
_, err := f.ClearRecords(tx, columnIDs)
|
||||
return err
|
||||
}
|
||||
|
||||
// ShardDistribution returns an object representing the distribution of shards
|
||||
// across nodes for each index, distinguishing between primary and replica.
|
||||
// The structure of this information is [indexName][nodeID][primaryOrReplica][]uint64.
|
||||
|
|
|
|||
18
api_test.go
18
api_test.go
|
|
@ -613,24 +613,6 @@ func TestAPI_Ingest(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
// ingestBenchmarkHelper makes it easier to exclude this from benchmark computations
|
||||
// and profiles.
|
||||
func ingestBenchmarkHelper() []byte {
|
||||
buf := &bytes.Buffer{}
|
||||
buf.WriteString(`[{"action": "write", "records": {`)
|
||||
comma := ""
|
||||
now := time.Now().Add(-3840000 * time.Second)
|
||||
for i := 0; i < 1000000; i++ {
|
||||
then := now.Add(time.Duration(rand.Int63n(1234567)) * time.Second)
|
||||
fmt.Fprintf(buf, `%s"%d": { "set": [%d, %d], "int": %d, "tq": { "time": "%s", "values": %d } }`, comma, i, i%2, (i%4)+2, rand.Int63n(163840),
|
||||
then.Format(time.RFC3339), rand.Int63n(25))
|
||||
comma = ", "
|
||||
}
|
||||
buf.WriteString(`}}]`)
|
||||
data := buf.Bytes()
|
||||
return data
|
||||
}
|
||||
|
||||
func TestAPI_ClearFlagForImportAndImportValues(t *testing.T) {
|
||||
c := test.MustRunCluster(t, 1)
|
||||
defer c.Close()
|
||||
|
|
|
|||
|
|
@ -2083,67 +2083,6 @@ func (h *Handler) handlePatchField(w http.ResponseWriter, r *http.Request) {
|
|||
resp.write(w, err)
|
||||
}
|
||||
|
||||
type ingestSpec struct {
|
||||
IndexName string `json:"index-name"`
|
||||
IndexAction string `json:"index-action"`
|
||||
FieldAction string `json:"field-action"`
|
||||
PrimaryKeyType string `json:"primary-key-type"`
|
||||
Fields []fieldSpec `json:"fields"`
|
||||
}
|
||||
|
||||
type fieldSpec struct {
|
||||
FieldName string `json:"field-name"`
|
||||
FieldType string `json:"field-type"`
|
||||
FieldOptions fieldOptionSpec `json:"field-options"`
|
||||
}
|
||||
|
||||
type fieldOptionSpec struct {
|
||||
EnforceMutualExclusion bool `json:"enforce-mutual-exclusion"`
|
||||
CacheType *string `json:"cache-type"`
|
||||
CacheSize *uint32 `json:"cache-size"`
|
||||
Scale *int64 `json:"scale"`
|
||||
Epoch *time.Time `json:"epoch"`
|
||||
Unit *string `json:"unit"`
|
||||
TimeQuantum *string `json:"time-quantum"`
|
||||
TTL *string `json:"ttl"`
|
||||
}
|
||||
|
||||
func fieldSpecToFieldOption(fSpec fieldSpec) fieldOptions {
|
||||
opt := fieldOptions{}
|
||||
// map fSpec type name to pilosa type name
|
||||
|
||||
// a string field could be a string set, mutex or time quantum
|
||||
if fSpec.FieldOptions.TimeQuantum != nil {
|
||||
opt.Type = "time"
|
||||
} else if fSpec.FieldOptions.EnforceMutualExclusion {
|
||||
opt.Type = "mutex"
|
||||
} else {
|
||||
opt.Type = "set"
|
||||
}
|
||||
|
||||
// for other field types, there's a one-to-one mapping
|
||||
if fSpec.FieldType != "string" && fSpec.FieldType != "id" {
|
||||
opt.Type = fSpec.FieldType
|
||||
}
|
||||
|
||||
if fSpec.FieldType == "string" {
|
||||
var keys bool = true
|
||||
opt.Keys = &keys
|
||||
}
|
||||
opt.CacheType = fSpec.FieldOptions.CacheType
|
||||
opt.CacheSize = fSpec.FieldOptions.CacheSize
|
||||
opt.Scale = fSpec.FieldOptions.Scale
|
||||
opt.Epoch = fSpec.FieldOptions.Epoch
|
||||
opt.TimeUnit = fSpec.FieldOptions.Unit
|
||||
if fSpec.FieldOptions.TimeQuantum != nil {
|
||||
timeQuantumVal := TimeQuantum(*fSpec.FieldOptions.TimeQuantum)
|
||||
opt.TimeQuantum = &timeQuantumVal
|
||||
}
|
||||
opt.TTL = fSpec.FieldOptions.TTL
|
||||
|
||||
return opt
|
||||
}
|
||||
|
||||
type postFieldRequest struct {
|
||||
Options fieldOptions `json:"options"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue