Documentation
¶
Overview ¶
Package wrappedstorage contains boilerplate code to allow easy SWIG-wrapping of C++ storage clients.
It also contains wrappedstorage.Interface, which should be implemented by any SWIG library providing a Go API to a SWIG storage wrapper. Implementing this interface allows SWIGged storage consumers to "reach in" and pull out the wrapper, in order to pass it into their C++ storage-consuming components.
Index ¶
- type Simple
- func (s *Simple) CountBenchmarkInfo(_ context.Context, biq *pgpb.BenchmarkInfoQuery) (*pgpb.CountResponse, error)
- func (s *Simple) CountRunInfo(_ context.Context, riq *pgpb.RunInfoQuery) (*pgpb.CountResponse, error)
- func (s *Simple) CreateBenchmarkInfo(_ context.Context, bi *pgpb.BenchmarkInfo) (*pgpb.CreationResponse, error)
- func (s *Simple) CreateRunInfo(_ context.Context, ri *pgpb.RunInfo) (*pgpb.CreationResponse, error)
- func (s *Simple) CreateSampleBatch(_ context.Context, sb *pgpb.SampleBatch) (*pgpb.CreationResponse, error)
- func (s *Simple) DeleteBenchmarkInfo(_ context.Context, biq *pgpb.BenchmarkInfoQuery) (*pgpb.ModificationResponse, error)
- func (s *Simple) DeleteRunInfo(_ context.Context, riq *pgpb.RunInfoQuery) (*pgpb.ModificationResponse, error)
- func (s *Simple) DeleteSampleBatch(_ context.Context, sbq *pgpb.SampleBatchQuery) (*pgpb.ModificationResponse, error)
- func (s *Simple) GetBatchSizeMax(_ context.Context) (int, error)
- func (s *Simple) GetHostname(_ context.Context) string
- func (s *Simple) GetMetricValueCountMax(_ context.Context) (int, error)
- func (s *Simple) GetSampleErrorCountMax(_ context.Context) (int, error)
- func (s *Simple) GetSwigWrap() SwigWrap
- func (s *Simple) QueryBenchmarkInfo(_ context.Context, biq *pgpb.BenchmarkInfoQuery) (*pgpb.BenchmarkInfoQueryResponse, error)
- func (s *Simple) QueryRunInfo(_ context.Context, riq *pgpb.RunInfoQuery) (*pgpb.RunInfoQueryResponse, error)
- func (s *Simple) QuerySampleBatch(_ context.Context, sbq *pgpb.SampleBatchQuery) (*pgpb.SampleBatchQueryResponse, error)
- func (s *Simple) UpdateBenchmarkInfo(_ context.Context, bi *pgpb.BenchmarkInfo) (*pgpb.ModificationResponse, error)
- func (s *Simple) UpdateRunInfo(_ context.Context, ri *pgpb.RunInfo) (*pgpb.ModificationResponse, error)
- type SimpleSwigWrap
- type Storage
- type SwigWrap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Simple ¶
type Simple struct {
// contains filtered or unexported fields
}
Simple is the most basic and straight-forward WrappedStorage implementation. Given an object satisfying simpleSwigWrap (in other words, given a simple wrapping of a mako::Storage*), it forwards all storage calls to it.
Simple wrappers like fake_storage.go and google3_storage.go embed this struct in order to not have to replicate this code.
Zero value is not useful. Use NewSimple().
func NewSimple ¶
func NewSimple(w SimpleSwigWrap, finalizer func()) *Simple
NewSimple returns a wrappedstorage.Simple that's ready to use. The given finalizer (which should clean up any SWIG-related memory) will be called when the object is garbage-collected.
Returns nil if `finalizer` is nil.
func (*Simple) CountBenchmarkInfo ¶
func (s *Simple) CountBenchmarkInfo(_ context.Context, biq *pgpb.BenchmarkInfoQuery) (*pgpb.CountResponse, error)
CountBenchmarkInfo counts matching benchmark info records. See interface description for more information.
func (*Simple) CountRunInfo ¶
func (s *Simple) CountRunInfo(_ context.Context, riq *pgpb.RunInfoQuery) (*pgpb.CountResponse, error)
CountRunInfo counts matching benchmark info records. See interface description for more information.
func (*Simple) CreateBenchmarkInfo ¶
func (s *Simple) CreateBenchmarkInfo(_ context.Context, bi *pgpb.BenchmarkInfo) (*pgpb.CreationResponse, error)
CreateBenchmarkInfo creates a benchmark info record. See interface description for more information.
func (*Simple) CreateRunInfo ¶
CreateRunInfo creates a benchmark info record. See interface description for more information.
func (*Simple) CreateSampleBatch ¶
func (s *Simple) CreateSampleBatch(_ context.Context, sb *pgpb.SampleBatch) (*pgpb.CreationResponse, error)
CreateSampleBatch creates a benchmark info record. See interface description for more information.
func (*Simple) DeleteBenchmarkInfo ¶
func (s *Simple) DeleteBenchmarkInfo(_ context.Context, biq *pgpb.BenchmarkInfoQuery) (*pgpb.ModificationResponse, error)
DeleteBenchmarkInfo deletes a benchmark info record. See interface description for more information.
func (*Simple) DeleteRunInfo ¶
func (s *Simple) DeleteRunInfo(_ context.Context, riq *pgpb.RunInfoQuery) (*pgpb.ModificationResponse, error)
DeleteRunInfo deletes a benchmark info record. See interface description for more information.
func (*Simple) DeleteSampleBatch ¶
func (s *Simple) DeleteSampleBatch(_ context.Context, sbq *pgpb.SampleBatchQuery) (*pgpb.ModificationResponse, error)
DeleteSampleBatch deletes a benchmark info record. See interface description for more information.
func (*Simple) GetBatchSizeMax ¶
GetBatchSizeMax returns the max binary size (in base 10 bytes). See interface description for more information.
func (*Simple) GetHostname ¶
GetHostname returns the hostname backing this Storage implementation. See interface description for more information.
func (*Simple) GetMetricValueCountMax ¶
GetMetricValueCountMax returns the max number of metric values that can be saved per run. See interface description for more information.
func (*Simple) GetSampleErrorCountMax ¶
GetSampleErrorCountMax returns the max number of errors that can be saved per run. See interface description for more information.
func (*Simple) GetSwigWrap ¶
GetSwigWrap returns the contained SWIG wrapper. Implements wrappedstorage.Interface.
func (*Simple) QueryBenchmarkInfo ¶
func (s *Simple) QueryBenchmarkInfo(_ context.Context, biq *pgpb.BenchmarkInfoQuery) (*pgpb.BenchmarkInfoQueryResponse, error)
QueryBenchmarkInfo queries a benchmark info record. See interface description for more information.
func (*Simple) QueryRunInfo ¶
func (s *Simple) QueryRunInfo(_ context.Context, riq *pgpb.RunInfoQuery) (*pgpb.RunInfoQueryResponse, error)
QueryRunInfo queries a benchmark info record. See interface description for more information.
func (*Simple) QuerySampleBatch ¶
func (s *Simple) QuerySampleBatch(_ context.Context, sbq *pgpb.SampleBatchQuery) (*pgpb.SampleBatchQueryResponse, error)
QuerySampleBatch queries a benchmark info record. See interface description for more information.
func (*Simple) UpdateBenchmarkInfo ¶
func (s *Simple) UpdateBenchmarkInfo(_ context.Context, bi *pgpb.BenchmarkInfo) (*pgpb.ModificationResponse, error)
UpdateBenchmarkInfo updates a benchmark info record. See interface description for more information.
func (*Simple) UpdateRunInfo ¶
func (s *Simple) UpdateRunInfo(_ context.Context, ri *pgpb.RunInfo) (*pgpb.ModificationResponse, error)
UpdateRunInfo updates a benchmark info record. See interface description for more information.
type SimpleSwigWrap ¶
type SimpleSwigWrap interface {
SwigWrap
CreateBenchmarkInfo(*pgpb.BenchmarkInfo, *pgpb.CreationResponse) bool
UpdateBenchmarkInfo(*pgpb.BenchmarkInfo, *pgpb.ModificationResponse) bool
QueryBenchmarkInfo(*pgpb.BenchmarkInfoQuery, *pgpb.BenchmarkInfoQueryResponse) bool
DeleteBenchmarkInfo(*pgpb.BenchmarkInfoQuery, *pgpb.ModificationResponse) bool
CountBenchmarkInfo(*pgpb.BenchmarkInfoQuery, *pgpb.CountResponse) bool
CreateRunInfo(*pgpb.RunInfo, *pgpb.CreationResponse) bool
UpdateRunInfo(*pgpb.RunInfo, *pgpb.ModificationResponse) bool
QueryRunInfo(*pgpb.RunInfoQuery, *pgpb.RunInfoQueryResponse) bool
DeleteRunInfo(*pgpb.RunInfoQuery, *pgpb.ModificationResponse) bool
CountRunInfo(*pgpb.RunInfoQuery, *pgpb.CountResponse) bool
CreateSampleBatch(*pgpb.SampleBatch, *pgpb.CreationResponse) bool
QuerySampleBatch(*pgpb.SampleBatchQuery, *pgpb.SampleBatchQueryResponse) bool
DeleteSampleBatch(*pgpb.SampleBatchQuery, *pgpb.ModificationResponse) bool
GetMetricValueCountMax(*int) string
GetSampleErrorCountMax(*int) string
GetBatchSizeMax(*int) string
GetHostname() string
}
SimpleSwigWrap is the interface of a direct, straight-forward wrapping of mako::Storage
type Storage ¶
type Storage interface {
GetSwigWrap() SwigWrap
}
Storage interface for a storage lib that provides a Go-native API to a SWIGged C++ storage implementation. A SWIGged Storage consumer can use GetSwigWrap() to get the lib's underlying SWIG wrapper, which can be passed to the C++ Storage consumer. Storage calls from this Storage consumer will then completely avoid the SWIG boundary and associated marshalling/unmarshalling.
Take care when making use of this behavior to early cleanup of the C++ resources while they're still being used. See go/mako-swig-to-swig.
It might be expected that this interface should embed the storage.Storage interface (in otherwords, that methods like CreateBenchmarkInfo should be defined), but this is not necessarily the case. The Go-side API could be completely different -- the important part is that there is an underlying C++ mako::Storage pointer.
type SwigWrap ¶
type SwigWrap interface {
Swigcptr() uintptr
}
SwigWrap is an interface for a SWIG wrapper. There is no way to statically determine that a struct's Swigcptr() returns a C Storage pointer (versus the pointer to some different type). Instead we rely on a runtime panic if the returned C pointer points to something else.