2021-12-28 09:43:26 +08:00
|
|
|
// Licensed to the LF AI & Data foundation 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 under the Apache License, Version 2.0 (the
|
|
|
|
// "License"); you may not use this file except in compliance
|
2021-04-19 11:32:24 +08:00
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
2021-12-28 09:43:26 +08:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2021-04-19 11:32:24 +08:00
|
|
|
//
|
2021-12-28 09:43:26 +08:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2021-04-19 11:32:24 +08:00
|
|
|
|
2020-12-07 15:22:20 +08:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
2023-06-09 01:28:37 +08:00
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
2020-12-07 15:22:20 +08:00
|
|
|
)
|
|
|
|
|
2021-12-14 20:03:20 +08:00
|
|
|
// PayloadWriterInterface abstracts PayloadWriter
|
2020-12-09 09:55:56 +08:00
|
|
|
type PayloadWriterInterface interface {
|
2023-06-14 18:04:38 +08:00
|
|
|
AddDataToPayload(msgs any, dim ...int) error
|
2020-12-09 09:55:56 +08:00
|
|
|
AddBoolToPayload(msgs []bool) error
|
2021-12-16 16:35:42 +08:00
|
|
|
AddByteToPayload(msgs []byte) error
|
2020-12-09 09:55:56 +08:00
|
|
|
AddInt8ToPayload(msgs []int8) error
|
|
|
|
AddInt16ToPayload(msgs []int16) error
|
|
|
|
AddInt32ToPayload(msgs []int32) error
|
|
|
|
AddInt64ToPayload(msgs []int64) error
|
|
|
|
AddFloatToPayload(msgs []float32) error
|
|
|
|
AddDoubleToPayload(msgs []float64) error
|
|
|
|
AddOneStringToPayload(msgs string) error
|
2023-04-20 11:32:31 +08:00
|
|
|
AddOneArrayToPayload(msg *schemapb.ScalarField) error
|
|
|
|
AddOneJSONToPayload(msg []byte) error
|
2020-12-09 09:55:56 +08:00
|
|
|
AddBinaryVectorToPayload(binVec []byte, dim int) error
|
|
|
|
AddFloatVectorToPayload(binVec []float32, dim int) error
|
|
|
|
FinishPayloadWriter() error
|
|
|
|
GetPayloadBufferFromWriter() ([]byte, error)
|
|
|
|
GetPayloadLengthFromWriter() (int, error)
|
2021-12-09 12:37:06 +08:00
|
|
|
ReleasePayloadWriter()
|
|
|
|
Close()
|
2020-12-09 09:55:56 +08:00
|
|
|
}
|
|
|
|
|
2021-12-14 20:03:20 +08:00
|
|
|
// PayloadReaderInterface abstracts PayloadReader
|
2020-12-09 09:55:56 +08:00
|
|
|
type PayloadReaderInterface interface {
|
2023-06-14 18:04:38 +08:00
|
|
|
GetDataFromPayload() (any, int, error)
|
2020-12-09 09:55:56 +08:00
|
|
|
GetBoolFromPayload() ([]bool, error)
|
2021-12-16 16:35:42 +08:00
|
|
|
GetByteFromPayload() ([]byte, error)
|
2020-12-09 09:55:56 +08:00
|
|
|
GetInt8FromPayload() ([]int8, error)
|
|
|
|
GetInt16FromPayload() ([]int16, error)
|
|
|
|
GetInt32FromPayload() ([]int32, error)
|
|
|
|
GetInt64FromPayload() ([]int64, error)
|
|
|
|
GetFloatFromPayload() ([]float32, error)
|
|
|
|
GetDoubleFromPayload() ([]float64, error)
|
2022-03-30 15:21:28 +08:00
|
|
|
GetStringFromPayload() ([]string, error)
|
2023-04-20 11:32:31 +08:00
|
|
|
GetArrayFromPayload() ([]*schemapb.ScalarField, error)
|
|
|
|
GetJSONFromPayload() ([][]byte, error)
|
2020-12-09 09:55:56 +08:00
|
|
|
GetBinaryVectorFromPayload() ([]byte, int, error)
|
|
|
|
GetFloatVectorFromPayload() ([]float32, int, error)
|
|
|
|
GetPayloadLengthFromReader() (int, error)
|
2023-03-20 10:41:56 +08:00
|
|
|
ReleasePayloadReader() error
|
|
|
|
Close() error
|
2020-12-09 09:55:56 +08:00
|
|
|
}
|