Documentation ¶
Overview ¶
Package indexrepo contains service code for gettting and managing indexed objects.
Index ¶
- type ObjectGetter
- type ObjectInfo
- type SearchOptions
- type Service
- func (s *Service) GetCloudEventFromIndex(ctx context.Context, index cloudevent.CloudEvent[ObjectInfo], ...) (cloudevent.CloudEvent[json.RawMessage], error)
- func (s *Service) GetLatestCloudEvent(ctx context.Context, bucketName string, opts *SearchOptions) (cloudevent.CloudEvent[json.RawMessage], error)
- func (s *Service) GetLatestIndex(ctx context.Context, opts *SearchOptions) (cloudevent.CloudEvent[ObjectInfo], error)
- func (s *Service) GetObjectFromKey(ctx context.Context, key, bucketName string) ([]byte, error)
- func (s *Service) ListCloudEvents(ctx context.Context, bucketName string, limit int, opts *SearchOptions) ([]cloudevent.CloudEvent[json.RawMessage], error)
- func (s *Service) ListCloudEventsFromIndexes(ctx context.Context, indexes []cloudevent.CloudEvent[ObjectInfo], ...) ([]cloudevent.CloudEvent[json.RawMessage], error)
- func (s *Service) ListIndexes(ctx context.Context, limit int, opts *SearchOptions) ([]cloudevent.CloudEvent[ObjectInfo], error)
- func (s *Service) ListObjectsFromKeys(ctx context.Context, keys []string, bucketName string) ([][]byte, error)
- func (s *Service) StoreObject(ctx context.Context, bucketName string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ObjectGetter ¶
type ObjectGetter interface { GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error) PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error) }
ObjectGetter is an interface for getting an object from S3.
type ObjectInfo ¶ added in v0.1.0
type ObjectInfo struct {
Key string
}
type SearchOptions ¶ added in v0.0.6
type SearchOptions struct { // After if set only objects after this time are returned. After time.Time // Before if set only objects before this time are returned. Before time.Time // Subject if set only objects for this subject are returned. Subject *string // TimestampAsc if set objects are queried and returned in ascending order by timestamp. // This option is not applied for the latest query. TimestampAsc bool // Type if not empty only objects with this type are returned. Type *string // ID if set only objects with this ID are returned. ID *string // Source is the party responsible for creating the data. Source *string // Producer is the specific source entity that created the data. Producer *string // DataVersion if set only objects for this data type are returned. DataVersion *string // DataContentType is the type of data of this object. DataContentType *string // Extras is the extra metadata for the cloud event. Extras *string // IndexKey is the key of the backing object for this cloud event. IndexKey *string }
SearchOptions contains options for searching for indexed objects.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages and retrieves data messages from indexed objects in S3.
func New ¶
func New(chConn clickhouse.Conn, objGetter ObjectGetter) *Service
New creates a new instance of serviceService.
func (*Service) GetCloudEventFromIndex ¶ added in v0.1.0
func (s *Service) GetCloudEventFromIndex(ctx context.Context, index cloudevent.CloudEvent[ObjectInfo], bucketName string) (cloudevent.CloudEvent[json.RawMessage], error)
GetCloudEventFromIndex fetches and returns the cloud event for the given index.
func (*Service) GetLatestCloudEvent ¶ added in v0.0.12
func (s *Service) GetLatestCloudEvent(ctx context.Context, bucketName string, opts *SearchOptions) (cloudevent.CloudEvent[json.RawMessage], error)
GetLatestCloudEvent fetches and returns the latest cloud event that matches the given options.
func (*Service) GetLatestIndex ¶ added in v0.1.0
func (s *Service) GetLatestIndex(ctx context.Context, opts *SearchOptions) (cloudevent.CloudEvent[ObjectInfo], error)
GetLatestIndex returns the latest cloud event index that matches the given options.
func (*Service) GetObjectFromKey ¶ added in v0.1.0
GetRawObjectFromKey fetches and returns the raw object for the given key without unmarshalling to a cloud event.
func (*Service) ListCloudEvents ¶ added in v0.0.12
func (s *Service) ListCloudEvents(ctx context.Context, bucketName string, limit int, opts *SearchOptions) ([]cloudevent.CloudEvent[json.RawMessage], error)
ListCloudEvents fetches and returns the cloud events that match the given options.
func (*Service) ListCloudEventsFromIndexes ¶ added in v0.1.0
func (s *Service) ListCloudEventsFromIndexes(ctx context.Context, indexes []cloudevent.CloudEvent[ObjectInfo], bucketName string) ([]cloudevent.CloudEvent[json.RawMessage], error)
ListCloudEventsFromIndexes fetches and returns the cloud events for the given index.
func (*Service) ListIndexes ¶ added in v0.1.0
func (s *Service) ListIndexes(ctx context.Context, limit int, opts *SearchOptions) ([]cloudevent.CloudEvent[ObjectInfo], error)
ListIndexes fetches and returns a list of index for cloud events that match the given options.
func (*Service) ListObjectsFromKeys ¶ added in v0.1.0
func (s *Service) ListObjectsFromKeys(ctx context.Context, keys []string, bucketName string) ([][]byte, error)
ListObjectsFromKeys fetches and returns the objects for the given keys.
func (*Service) StoreObject ¶ added in v0.0.10
func (s *Service) StoreObject(ctx context.Context, bucketName string, cloudHeader *cloudevent.CloudEventHeader, data []byte) error
StoreObject stores the given data in S3 with the given cloudevent header.