Rename Storable interface to Storer
See https://golang.org/doc/effective_go.html#interface-names
This commit is contained in:
parent
11b7803305
commit
24f8457d71
@ -32,7 +32,7 @@ type (
|
||||
//
|
||||
// Value will be type-casted when assigned to sys/msg/cmp services
|
||||
// with warnings when incompatible
|
||||
Store store.Storable
|
||||
Store store.Storer
|
||||
|
||||
// CLI Commands
|
||||
Command *cobra.Command
|
||||
|
||||
@ -31,7 +31,7 @@ type (
|
||||
actionlog actionlog.Recorder
|
||||
files files.Store
|
||||
ac attachmentAccessController
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
attachmentAccessController interface {
|
||||
@ -144,7 +144,7 @@ func (svc attachment) DeleteByID(namespaceID, attachmentID uint64) (err error) {
|
||||
aProps = &attachmentActionProps{attachment: &types.Attachment{ID: attachmentID}}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if attachmentID == 0 {
|
||||
return AttachmentErrInvalidID()
|
||||
}
|
||||
@ -295,7 +295,7 @@ func (svc attachment) CreateRecordAttachment(namespaceID uint64, name string, si
|
||||
}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
ns, m, err = loadModuleWithNamespace(ctx, s, namespaceID, moduleID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@ -15,7 +15,7 @@ type (
|
||||
ctx context.Context
|
||||
actionlog actionlog.Recorder
|
||||
ac chartAccessController
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
chartAccessController interface {
|
||||
@ -197,7 +197,7 @@ func (svc chart) updater(namespaceID, chartID uint64, action func(...*chartActio
|
||||
err error
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
ns, c, err = loadChart(ctx, s, namespaceID, chartID)
|
||||
if err != nil {
|
||||
return
|
||||
@ -282,7 +282,7 @@ func (svc chart) handleUndelete(ctx context.Context, ns *types.Namespace, c *typ
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func loadChart(ctx context.Context, s store.Storable, namespaceID, chartID uint64) (ns *types.Namespace, c *types.Chart, err error) {
|
||||
func loadChart(ctx context.Context, s store.Storer, namespaceID, chartID uint64) (ns *types.Namespace, c *types.Chart, err error) {
|
||||
if chartID == 0 {
|
||||
return nil, nil, ChartErrInvalidID()
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ type (
|
||||
actionlog actionlog.Recorder
|
||||
ac moduleAccessController
|
||||
eventbus eventDispatcher
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
moduleAccessController interface {
|
||||
@ -163,7 +163,7 @@ func (svc module) Create(new *types.Module) (*types.Module, error) {
|
||||
aProps = &moduleActionProps{changed: new}
|
||||
)
|
||||
|
||||
err := store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err := store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if !handle.IsValid(new.Handle) {
|
||||
return ModuleErrInvalidHandle()
|
||||
}
|
||||
@ -241,7 +241,7 @@ func (svc module) updater(namespaceID, moduleID uint64, action func(...*moduleAc
|
||||
err error
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
ns, m, err = loadModuleWithNamespace(svc.ctx, s, namespaceID, moduleID)
|
||||
if err != nil {
|
||||
return
|
||||
@ -426,7 +426,7 @@ func (svc module) handleUndelete(ctx context.Context, ns *types.Namespace, m *ty
|
||||
// updates module fields
|
||||
// expecting to receive all module fields, as it deletes the rest
|
||||
// also, sort order of the fields is also important as this fn stores and updates field's place as send
|
||||
func updateModuleFields(ctx context.Context, s store.Storable, m *types.Module, newFields types.ModuleFieldSet, hasRecords bool) (err error) {
|
||||
func updateModuleFields(ctx context.Context, s store.Storer, m *types.Module, newFields types.ModuleFieldSet, hasRecords bool) (err error) {
|
||||
for _, f := range newFields {
|
||||
// Set module ID to all new fields
|
||||
if f.ModuleID == 0 {
|
||||
@ -488,7 +488,7 @@ func updateModuleFields(ctx context.Context, s store.Storable, m *types.Module,
|
||||
return nil
|
||||
}
|
||||
|
||||
func loadModuleFields(ctx context.Context, s store.Storable, mm ...*types.Module) (err error) {
|
||||
func loadModuleFields(ctx context.Context, s store.Storer, mm ...*types.Module) (err error) {
|
||||
if len(mm) == 0 {
|
||||
return nil
|
||||
}
|
||||
@ -511,7 +511,7 @@ func loadModuleFields(ctx context.Context, s store.Storable, mm ...*types.Module
|
||||
}
|
||||
|
||||
// loads record module with fields and namespace
|
||||
func loadModuleWithNamespace(ctx context.Context, s store.Storable, namespaceID, moduleID uint64) (ns *types.Namespace, m *types.Module, err error) {
|
||||
func loadModuleWithNamespace(ctx context.Context, s store.Storer, namespaceID, moduleID uint64) (ns *types.Namespace, m *types.Module, err error) {
|
||||
if moduleID == 0 {
|
||||
return nil, nil, ModuleErrInvalidID()
|
||||
}
|
||||
@ -532,7 +532,7 @@ func loadModuleWithNamespace(ctx context.Context, s store.Storable, namespaceID,
|
||||
return
|
||||
}
|
||||
|
||||
func loadModule(ctx context.Context, s store.Storable, moduleID uint64) (m *types.Module, err error) {
|
||||
func loadModule(ctx context.Context, s store.Storer, moduleID uint64) (m *types.Module, err error) {
|
||||
if moduleID == 0 {
|
||||
return nil, ModuleErrInvalidID()
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ type (
|
||||
actionlog actionlog.Recorder
|
||||
ac namespaceAccessController
|
||||
eventbus eventDispatcher
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
namespaceAccessController interface {
|
||||
@ -147,7 +147,7 @@ func (svc namespace) Create(new *types.Namespace) (ns *types.Namespace, err erro
|
||||
aProps = &namespaceActionProps{changed: new}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
if !handle.IsValid(new.Slug) {
|
||||
return NamespaceErrInvalidHandle()
|
||||
}
|
||||
@ -195,7 +195,7 @@ func (svc namespace) updater(namespaceID uint64, action func(...*namespaceAction
|
||||
err error
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
ns, err = loadNamespace(svc.ctx, s, namespaceID)
|
||||
if err != nil {
|
||||
return
|
||||
@ -327,7 +327,7 @@ func (svc namespace) handleUndelete(ctx context.Context, ns *types.Namespace) (b
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func loadNamespace(ctx context.Context, s store.Storable, namespaceID uint64) (ns *types.Namespace, err error) {
|
||||
func loadNamespace(ctx context.Context, s store.Storer, namespaceID uint64) (ns *types.Namespace, err error) {
|
||||
if namespaceID == 0 {
|
||||
return nil, ChartErrInvalidNamespaceID()
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ type (
|
||||
actionlog actionlog.Recorder
|
||||
ac pageAccessController
|
||||
eventbus eventDispatcher
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
pageAccessController interface {
|
||||
@ -199,7 +199,7 @@ func (svc page) Reorder(namespaceID, parentID uint64, pageIDs []uint64) (err err
|
||||
p *types.Page
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
if ns, err = loadNamespace(ctx, s, namespaceID); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -239,7 +239,7 @@ func (svc page) Create(new *types.Page) (p *types.Page, err error) {
|
||||
|
||||
new.ID = 0
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
if !handle.IsValid(new.Handle) {
|
||||
return PageErrInvalidID()
|
||||
}
|
||||
@ -295,7 +295,7 @@ func (svc page) updater(namespaceID, pageID uint64, action func(...*pageActionPr
|
||||
err error
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
ns, p, err = loadPage(svc.ctx, s, namespaceID, pageID)
|
||||
if err != nil {
|
||||
return
|
||||
@ -443,7 +443,7 @@ func (svc page) handleUndelete(ctx context.Context, ns *types.Namespace, m *type
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func loadPage(ctx context.Context, s store.Storable, namespaceID, pageID uint64) (ns *types.Namespace, m *types.Page, err error) {
|
||||
func loadPage(ctx context.Context, s store.Storer, namespaceID, pageID uint64) (ns *types.Namespace, m *types.Page, err error) {
|
||||
if pageID == 0 {
|
||||
return nil, nil, PageErrInvalidID()
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ type (
|
||||
ac recordAccessController
|
||||
eventbus eventDispatcher
|
||||
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
|
||||
formatter recordValuesFormatter
|
||||
sanitizer recordValuesSanitizer
|
||||
@ -51,7 +51,7 @@ type (
|
||||
}
|
||||
|
||||
recordValuesValidator interface {
|
||||
Run(context.Context, store.Storable, *types.Module, *types.Record) *types.RecordValueErrorSet
|
||||
Run(context.Context, store.Storer, *types.Module, *types.Record) *types.RecordValueErrorSet
|
||||
UniqueChecker(fn values.UniqueChecker)
|
||||
RecordRefChecker(fn values.ReferenceChecker)
|
||||
UserRefChecker(fn values.ReferenceChecker)
|
||||
@ -144,7 +144,7 @@ func (svc record) With(ctx context.Context) RecordService {
|
||||
// Initialize validator and setup all checkers it needs
|
||||
validator := values.Validator()
|
||||
|
||||
validator.UniqueChecker(func(ctx context.Context, s store.Storable, v *types.RecordValue, f *types.ModuleField, m *types.Module) (uint64, error) {
|
||||
validator.UniqueChecker(func(ctx context.Context, s store.Storer, v *types.RecordValue, f *types.ModuleField, m *types.Module) (uint64, error) {
|
||||
if v.Ref == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
@ -152,7 +152,7 @@ func (svc record) With(ctx context.Context) RecordService {
|
||||
return store.ComposeRecordValueRefLookup(ctx, s, m, f.Name, v.Ref)
|
||||
})
|
||||
|
||||
validator.RecordRefChecker(func(ctx context.Context, s store.Storable, v *types.RecordValue, f *types.ModuleField, m *types.Module) (bool, error) {
|
||||
validator.RecordRefChecker(func(ctx context.Context, s store.Storer, v *types.RecordValue, f *types.ModuleField, m *types.Module) (bool, error) {
|
||||
if v.Ref == 0 {
|
||||
return false, nil
|
||||
}
|
||||
@ -161,12 +161,12 @@ func (svc record) With(ctx context.Context) RecordService {
|
||||
return r != nil, err
|
||||
})
|
||||
|
||||
validator.UserRefChecker(func(ctx context.Context, s store.Storable, v *types.RecordValue, f *types.ModuleField, m *types.Module) (bool, error) {
|
||||
validator.UserRefChecker(func(ctx context.Context, s store.Storer, v *types.RecordValue, f *types.ModuleField, m *types.Module) (bool, error) {
|
||||
r, err := store.LookupUserByID(ctx, s, v.Ref)
|
||||
return r != nil, err
|
||||
})
|
||||
|
||||
validator.FileRefChecker(func(ctx context.Context, s store.Storable, v *types.RecordValue, f *types.ModuleField, m *types.Module) (bool, error) {
|
||||
validator.FileRefChecker(func(ctx context.Context, s store.Storer, v *types.RecordValue, f *types.ModuleField, m *types.Module) (bool, error) {
|
||||
if v.Ref == 0 {
|
||||
return false, nil
|
||||
}
|
||||
@ -533,7 +533,7 @@ func (svc record) create(new *types.Record) (rec *types.Record, err error) {
|
||||
return nil, RecordErrValueInput().Wrap(rve)
|
||||
}
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
return store.CreateComposeRecord(ctx, s, m, new)
|
||||
})
|
||||
|
||||
@ -628,7 +628,7 @@ func (svc record) update(upd *types.Record) (rec *types.Record, err error) {
|
||||
return nil, RecordErrValueInput().Wrap(rve)
|
||||
}
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
return store.UpdateComposeRecord(ctx, s, m, upd)
|
||||
|
||||
})
|
||||
@ -673,7 +673,7 @@ func (svc record) Create(new *types.Record) (rec *types.Record, err error) {
|
||||
// of the creation procedure and after results are back from the automation scripts
|
||||
//
|
||||
// Both these points introduce external data that need to be checked fully in the same manner
|
||||
func (svc record) procCreate(ctx context.Context, s store.Storable, invokerID uint64, m *types.Module, new *types.Record) *types.RecordValueErrorSet {
|
||||
func (svc record) procCreate(ctx context.Context, s store.Storer, invokerID uint64, m *types.Module, new *types.Record) *types.RecordValueErrorSet {
|
||||
// Mark all values as updated (new)
|
||||
new.Values.SetUpdatedFlag(true)
|
||||
|
||||
@ -723,7 +723,7 @@ func (svc record) Update(upd *types.Record) (rec *types.Record, err error) {
|
||||
// of the update procedure and after results are back from the automation scripts
|
||||
//
|
||||
// Both these points introduce external data that need to be checked fully in the same manner
|
||||
func (svc record) procUpdate(ctx context.Context, s store.Storable, invokerID uint64, m *types.Module, upd *types.Record, old *types.Record) *types.RecordValueErrorSet {
|
||||
func (svc record) procUpdate(ctx context.Context, s store.Storer, invokerID uint64, m *types.Module, upd *types.Record, old *types.Record) *types.RecordValueErrorSet {
|
||||
// Mark all values as updated (new)
|
||||
upd.Values.SetUpdatedFlag(true)
|
||||
|
||||
@ -808,7 +808,7 @@ func (svc record) delete(namespaceID, moduleID, recordID uint64) (del *types.Rec
|
||||
del.DeletedAt = nowPtr()
|
||||
del.DeletedBy = invokerID
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
return store.UpdateComposeRecord(ctx, s, m, del)
|
||||
})
|
||||
|
||||
@ -977,7 +977,7 @@ func (svc record) Organize(namespaceID, moduleID, recordID uint64, posField, pos
|
||||
})
|
||||
}
|
||||
|
||||
return store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
return store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
if len(recordValues) > 0 {
|
||||
svc.recordInfoUpdate(r)
|
||||
if err = store.UpdateComposeRecord(ctx, s, m, r); err != nil {
|
||||
@ -1172,7 +1172,7 @@ func (svc record) Iterator(f types.RecordFilter, fn eventbus.HandlerFn, action s
|
||||
return RecordErrValueInput().Wrap(rve)
|
||||
}
|
||||
|
||||
return store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
return store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
return store.CreateComposeRecord(ctx, s, m, rec)
|
||||
})
|
||||
case "update":
|
||||
@ -1183,13 +1183,13 @@ func (svc record) Iterator(f types.RecordFilter, fn eventbus.HandlerFn, action s
|
||||
return RecordErrValueInput().Wrap(rve)
|
||||
}
|
||||
|
||||
return store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
return store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
return store.UpdateComposeRecord(ctx, s, m, rec)
|
||||
})
|
||||
case "delete":
|
||||
recordableAction = RecordActionIteratorDelete
|
||||
|
||||
return store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) error {
|
||||
return store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) error {
|
||||
rec.DeletedAt = nowPtr()
|
||||
rec.DeletedBy = invokerID
|
||||
return store.UpdateComposeRecord(ctx, s, m, rec)
|
||||
@ -1313,7 +1313,7 @@ func trimUnreadableRecordFields(ctx context.Context, ac recordValueAccessControl
|
||||
}
|
||||
|
||||
// loadRecordCombo Loads namespace, module and record
|
||||
func loadRecordCombo(ctx context.Context, s store.Storable, namespaceID, moduleID, recordID uint64) (ns *types.Namespace, m *types.Module, r *types.Record, err error) {
|
||||
func loadRecordCombo(ctx context.Context, s store.Storer, namespaceID, moduleID, recordID uint64) (ns *types.Namespace, m *types.Module, r *types.Record, err error) {
|
||||
if ns, m, err = loadModuleWithNamespace(ctx, s, namespaceID, moduleID); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ func TestDefaultValueSetting(t *testing.T) {
|
||||
func TestProcUpdateOwnerPreservation(t *testing.T) {
|
||||
var (
|
||||
ctx = context.Background()
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
|
||||
a = assert.New(t)
|
||||
|
||||
@ -127,7 +127,7 @@ func TestProcUpdateOwnerPreservation(t *testing.T) {
|
||||
func TestProcUpdateOwnerChanged(t *testing.T) {
|
||||
var (
|
||||
ctx = context.Background()
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
|
||||
a = assert.New(t)
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ var (
|
||||
// DefaultNgStore is an interface to storage backend(s)
|
||||
// ng (next-gen) is a temporary prefix
|
||||
// so that we can differentiate between it and the file-only store
|
||||
DefaultNgStore ngStore.Storable
|
||||
DefaultNgStore ngStore.Storer
|
||||
|
||||
DefaultLogger *zap.Logger
|
||||
|
||||
@ -73,7 +73,7 @@ var (
|
||||
)
|
||||
|
||||
// Initializes compose-only services
|
||||
func Initialize(ctx context.Context, log *zap.Logger, s ngStore.Storable, c Config) (err error) {
|
||||
func Initialize(ctx context.Context, log *zap.Logger, s ngStore.Storer, c Config) (err error) {
|
||||
var (
|
||||
hcd = healthcheck.Defaults()
|
||||
)
|
||||
|
||||
@ -21,8 +21,8 @@ import (
|
||||
// is no need for such level of interaction and dynamic we require on the frontend
|
||||
|
||||
type (
|
||||
UniqueChecker func(context.Context, store.Storable, *types.RecordValue, *types.ModuleField, *types.Module) (uint64, error)
|
||||
ReferenceChecker func(context.Context, store.Storable, *types.RecordValue, *types.ModuleField, *types.Module) (bool, error)
|
||||
UniqueChecker func(context.Context, store.Storer, *types.RecordValue, *types.ModuleField, *types.Module) (uint64, error)
|
||||
ReferenceChecker func(context.Context, store.Storer, *types.RecordValue, *types.ModuleField, *types.Module) (bool, error)
|
||||
|
||||
validator struct {
|
||||
uniqueCheckerFn UniqueChecker
|
||||
@ -93,7 +93,7 @@ func (vldtr *validator) FileRefChecker(fn ReferenceChecker) {
|
||||
// - check for unique-multi-value in multi value fields
|
||||
// - field-kind specific validation on all values
|
||||
// - unique check on all all values
|
||||
func (vldtr validator) Run(ctx context.Context, s store.Storable, m *types.Module, r *types.Record) (out *types.RecordValueErrorSet) {
|
||||
func (vldtr validator) Run(ctx context.Context, s store.Storer, m *types.Module, r *types.Record) (out *types.RecordValueErrorSet) {
|
||||
var (
|
||||
f *types.ModuleField
|
||||
)
|
||||
@ -262,7 +262,7 @@ func (vldtr validator) vEmail(v *types.RecordValue, f *types.ModuleField, r *typ
|
||||
return nil
|
||||
}
|
||||
|
||||
func (vldtr validator) vFile(ctx context.Context, s store.Storable, v *types.RecordValue, f *types.ModuleField, r *types.Record, m *types.Module) []types.RecordValueError {
|
||||
func (vldtr validator) vFile(ctx context.Context, s store.Storer, v *types.RecordValue, f *types.ModuleField, r *types.Record, m *types.Module) []types.RecordValueError {
|
||||
if ok, err := vldtr.fileRefCheckerFn(ctx, s, v, f, m); err != nil {
|
||||
return e2s(makeInternalErr(f, err))
|
||||
} else if !ok {
|
||||
@ -284,7 +284,7 @@ func (vldtr validator) vNumber(v *types.RecordValue, f *types.ModuleField, r *ty
|
||||
return nil
|
||||
}
|
||||
|
||||
func (vldtr validator) vRecord(ctx context.Context, s store.Storable, v *types.RecordValue, f *types.ModuleField, r *types.Record, m *types.Module) []types.RecordValueError {
|
||||
func (vldtr validator) vRecord(ctx context.Context, s store.Storer, v *types.RecordValue, f *types.ModuleField, r *types.Record, m *types.Module) []types.RecordValueError {
|
||||
if ok, err := vldtr.recordRefCheckerFn(ctx, s, v, f, m); err != nil {
|
||||
return e2s(makeInternalErr(f, err))
|
||||
} else if !ok {
|
||||
@ -337,7 +337,7 @@ func (vldtr validator) vUrl(v *types.RecordValue, f *types.ModuleField, r *types
|
||||
return nil
|
||||
}
|
||||
|
||||
func (vldtr validator) vUser(ctx context.Context, s store.Storable, v *types.RecordValue, f *types.ModuleField, r *types.Record, m *types.Module) []types.RecordValueError {
|
||||
func (vldtr validator) vUser(ctx context.Context, s store.Storer, v *types.RecordValue, f *types.ModuleField, r *types.Record, m *types.Module) []types.RecordValueError {
|
||||
if ok, err := vldtr.userRefCheckerFn(ctx, s, v, f, m); err != nil {
|
||||
return e2s(makeInternalErr(f, err))
|
||||
} else if !ok {
|
||||
|
||||
@ -35,7 +35,7 @@ type (
|
||||
ac attachmentAccessController
|
||||
|
||||
files files.Store
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
event EventService
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ func (svc attachment) CreateMessageAttachment(name string, size int64, fh io.Rea
|
||||
ch *types.Channel
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
|
||||
if ch, err = store.LookupMessagingChannelByID(ctx, s, channelID); err != nil {
|
||||
if errors.Is(err, store.ErrNotFound) {
|
||||
|
||||
@ -18,7 +18,7 @@ type (
|
||||
ac applicationAccessController
|
||||
|
||||
actionlog actionlog.Recorder
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
|
||||
sysmsgs types.MessageSet
|
||||
}
|
||||
@ -145,7 +145,7 @@ func (svc *channel) Find(filter types.ChannelFilter) (set types.ChannelSet, f ty
|
||||
}
|
||||
|
||||
// preloadExtras pre-loads channel's members, views
|
||||
func (svc *channel) preloadExtras(ctx context.Context, s store.Storable, cc ...*types.Channel) (err error) {
|
||||
func (svc *channel) preloadExtras(ctx context.Context, s store.Storer, cc ...*types.Channel) (err error) {
|
||||
if len(cc) == 0 {
|
||||
return nil
|
||||
}
|
||||
@ -165,7 +165,7 @@ func (svc *channel) preloadExtras(ctx context.Context, s store.Storable, cc ...*
|
||||
return
|
||||
}
|
||||
|
||||
func (channel) preloadMembers(ctx context.Context, s store.Storable, cc ...*types.Channel) (err error) {
|
||||
func (channel) preloadMembers(ctx context.Context, s store.Storer, cc ...*types.Channel) (err error) {
|
||||
if len(cc) == 0 {
|
||||
return nil
|
||||
}
|
||||
@ -190,7 +190,7 @@ func (channel) preloadMembers(ctx context.Context, s store.Storable, cc ...*type
|
||||
return
|
||||
}
|
||||
|
||||
func (channel) preloadUnreads(ctx context.Context, s store.Storable, cc ...*types.Channel) (err error) {
|
||||
func (channel) preloadUnreads(ctx context.Context, s store.Storer, cc ...*types.Channel) (err error) {
|
||||
if len(cc) == 0 {
|
||||
return nil
|
||||
}
|
||||
@ -254,7 +254,7 @@ func (svc *channel) Create(new *types.Channel) (ch *types.Channel, err error) {
|
||||
aProps = &channelActionProps{changed: new}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if !new.Type.IsValid() {
|
||||
return ChannelErrInvalidType()
|
||||
}
|
||||
@ -395,7 +395,7 @@ func (svc *channel) Update(upd *types.Channel) (ch *types.Channel, err error) {
|
||||
aProps = &channelActionProps{changed: upd}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if upd.ID == 0 {
|
||||
return ChannelErrInvalidID()
|
||||
}
|
||||
@ -503,7 +503,7 @@ func (svc *channel) Delete(ID uint64) (ch *types.Channel, err error) {
|
||||
aProps = &channelActionProps{}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if ID == 0 {
|
||||
return ChannelErrInvalidID()
|
||||
}
|
||||
@ -546,7 +546,7 @@ func (svc *channel) Undelete(ID uint64) (ch *types.Channel, err error) {
|
||||
aProps = &channelActionProps{}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if ID == 0 {
|
||||
return ChannelErrInvalidID()
|
||||
}
|
||||
@ -587,7 +587,7 @@ func (svc *channel) SetFlag(ID uint64, flag types.ChannelMembershipFlag) (ch *ty
|
||||
aProps = &channelActionProps{flag: string(flag)}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if ID == 0 {
|
||||
return ChannelErrInvalidID()
|
||||
}
|
||||
@ -633,7 +633,7 @@ func (svc *channel) Archive(ID uint64) (ch *types.Channel, err error) {
|
||||
aProps = &channelActionProps{}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if ID == 0 {
|
||||
return ChannelErrInvalidID()
|
||||
}
|
||||
@ -673,7 +673,7 @@ func (svc *channel) Unarchive(ID uint64) (ch *types.Channel, err error) {
|
||||
aProps = &channelActionProps{}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if ID == 0 {
|
||||
return ChannelErrInvalidID()
|
||||
}
|
||||
@ -713,7 +713,7 @@ func (svc *channel) InviteUser(channelID uint64, memberIDs ...uint64) (out types
|
||||
aProps = &channelActionProps{}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if channelID == 0 {
|
||||
return ChannelErrInvalidID()
|
||||
}
|
||||
@ -785,7 +785,7 @@ func (svc *channel) AddMember(channelID uint64, memberIDs ...uint64) (out types.
|
||||
aProps = &channelActionProps{}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
if channelID == 0 {
|
||||
return ChannelErrInvalidID()
|
||||
}
|
||||
@ -879,7 +879,7 @@ func (svc *channel) AddMember(channelID uint64, memberIDs ...uint64) (out types.
|
||||
}
|
||||
|
||||
// createMember orchestrates member creation
|
||||
func (svc channel) createMember(ctx context.Context, s store.Storable, m *types.ChannelMember) (err error) {
|
||||
func (svc channel) createMember(ctx context.Context, s store.Storer, m *types.ChannelMember) (err error) {
|
||||
m.CreatedAt = *now()
|
||||
|
||||
if err = store.CreateMessagingChannelMember(ctx, s, m); err != nil {
|
||||
@ -899,7 +899,7 @@ func (svc *channel) DeleteMember(channelID uint64, memberIDs ...uint64) (err err
|
||||
aProps = &channelActionProps{}
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
var (
|
||||
userID = auth.GetIdentityFromContext(svc.ctx).Identity()
|
||||
ch *types.Channel
|
||||
|
||||
@ -18,7 +18,7 @@ type (
|
||||
ctx context.Context
|
||||
ac messageAccessController
|
||||
channel ChannelService
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
event EventService
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ func (svc message) Create(msg *types.Message) (*types.Message, error) {
|
||||
msg.UserID = auth.GetIdentityFromContext(svc.ctx).Identity()
|
||||
}
|
||||
|
||||
err := store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err := store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
// Broadcast queue
|
||||
var bq = types.MessageSet{}
|
||||
var ch *types.Channel
|
||||
@ -265,7 +265,7 @@ func (svc message) Update(upd *types.Message) (msg *types.Message, err error) {
|
||||
|
||||
var currentUserID = auth.GetIdentityFromContext(svc.ctx).Identity()
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
var ch *types.Channel
|
||||
|
||||
if ch, err = svc.findChannelByID(upd.ChannelID); err != nil {
|
||||
@ -318,7 +318,7 @@ func (svc message) Delete(messageID uint64) (err error) {
|
||||
|
||||
_ = currentUserID
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
// Broadcast queue
|
||||
var bq = types.MessageSet{}
|
||||
var deletedMsg, original *types.Message
|
||||
@ -397,7 +397,7 @@ func (svc message) MarkAsRead(channelID, threadID, lastReadMessageID uint64) (ui
|
||||
err error
|
||||
)
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
var ch *types.Channel
|
||||
var thread *types.Message
|
||||
var lastMessage *types.Message
|
||||
@ -540,7 +540,7 @@ func (svc message) flag(messageID uint64, flag string, remove bool) (err error)
|
||||
flagOwnerID = 0
|
||||
}
|
||||
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storable) (err error) {
|
||||
err = store.Tx(svc.ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) {
|
||||
var (
|
||||
ff types.MessageFlagSet
|
||||
f *types.MessageFlag
|
||||
@ -620,7 +620,7 @@ func (svc message) flag(messageID uint64, flag string, remove bool) (err error)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (svc message) preload(ctx context.Context, s store.Storable, mm types.MessageSet) (err error) {
|
||||
func (svc message) preload(ctx context.Context, s store.Storer, mm types.MessageSet) (err error) {
|
||||
if err = svc.preloadAttachments(ctx, s, mm); err != nil {
|
||||
return
|
||||
}
|
||||
@ -645,7 +645,7 @@ func (svc message) preload(ctx context.Context, s store.Storable, mm types.Messa
|
||||
}
|
||||
|
||||
// Preload for all messages
|
||||
func (message) preloadFlags(ctx context.Context, s store.Storable, mm types.MessageSet) (err error) {
|
||||
func (message) preloadFlags(ctx context.Context, s store.Storer, mm types.MessageSet) (err error) {
|
||||
if len(mm) == 0 {
|
||||
return
|
||||
}
|
||||
@ -663,7 +663,7 @@ func (message) preloadFlags(ctx context.Context, s store.Storable, mm types.Mess
|
||||
}
|
||||
|
||||
// Preload for all messages
|
||||
func (message) preloadMentions(ctx context.Context, s store.Storable, mm types.MessageSet) (err error) {
|
||||
func (message) preloadMentions(ctx context.Context, s store.Storer, mm types.MessageSet) (err error) {
|
||||
if len(mm) == 0 {
|
||||
return
|
||||
}
|
||||
@ -680,7 +680,7 @@ func (message) preloadMentions(ctx context.Context, s store.Storable, mm types.M
|
||||
})
|
||||
}
|
||||
|
||||
func (message) preloadAttachments(ctx context.Context, s store.Storable, mm types.MessageSet) (err error) {
|
||||
func (message) preloadAttachments(ctx context.Context, s store.Storer, mm types.MessageSet) (err error) {
|
||||
var (
|
||||
aa types.AttachmentSet
|
||||
)
|
||||
@ -706,7 +706,7 @@ func (message) preloadAttachments(ctx context.Context, s store.Storable, mm type
|
||||
}
|
||||
}
|
||||
|
||||
func (message) preloadUnreads(ctx context.Context, s store.Storable, mm types.MessageSet) (err error) {
|
||||
func (message) preloadUnreads(ctx context.Context, s store.Storer, mm types.MessageSet) (err error) {
|
||||
if len(mm) == 0 {
|
||||
return nil
|
||||
}
|
||||
@ -732,7 +732,7 @@ func (message) preloadUnreads(ctx context.Context, s store.Storable, mm types.Me
|
||||
})
|
||||
}
|
||||
|
||||
func (message) preloadThreadParticipants(ctx context.Context, s store.Storable, mm types.MessageSet) (err error) {
|
||||
func (message) preloadThreadParticipants(ctx context.Context, s store.Storer, mm types.MessageSet) (err error) {
|
||||
if len(mm) == 0 {
|
||||
return nil
|
||||
}
|
||||
@ -785,7 +785,7 @@ func (svc message) sendNotifications(message *types.Message, mentions types.Ment
|
||||
// 1. increases/decreases unread counters for channel or thread
|
||||
// 2. collects all counters for channel or thread
|
||||
// 3. sends unread events to subscribers
|
||||
func (svc message) countUnreads(ctx context.Context, s store.Storable, ch *types.Channel, m *types.Message, userID uint64) (err error) {
|
||||
func (svc message) countUnreads(ctx context.Context, s store.Storer, ch *types.Channel, m *types.Message, userID uint64) (err error) {
|
||||
var (
|
||||
uuBase, uuThreads, uuChannels types.UnreadSet
|
||||
// mm types.ChannelMemberSet
|
||||
@ -888,7 +888,7 @@ func (svc message) extractMentions(m *types.Message) (mm types.MentionSet) {
|
||||
return
|
||||
}
|
||||
|
||||
func (svc message) updateMentions(ctx context.Context, s store.Storable, messageID uint64, mm types.MentionSet) error {
|
||||
func (svc message) updateMentions(ctx context.Context, s store.Storer, messageID uint64, mm types.MentionSet) error {
|
||||
if existing, _, err := store.SearchMessagingMentions(ctx, s, types.MentionFilter{MessageID: []uint64{messageID}}); err != nil {
|
||||
return fmt.Errorf("could not update mentions: %w", err)
|
||||
} else if len(mm) > 0 {
|
||||
|
||||
@ -36,7 +36,7 @@ var (
|
||||
// DefaultNgStore is an interface to storage backend(s)
|
||||
// ng (next-gen) is a temporary prefix
|
||||
// so that we can differentiate between it and the file-only store
|
||||
DefaultNgStore ngStore.Storable
|
||||
DefaultNgStore ngStore.Storer
|
||||
|
||||
DefaultPermissions permissionServicer
|
||||
|
||||
@ -53,7 +53,7 @@ var (
|
||||
DefaultCommand CommandService
|
||||
)
|
||||
|
||||
func Initialize(ctx context.Context, log *zap.Logger, s ngStore.Storable, c Config) (err error) {
|
||||
func Initialize(ctx context.Context, log *zap.Logger, s ngStore.Storer, c Config) (err error) {
|
||||
var (
|
||||
hcd = healthcheck.Defaults()
|
||||
)
|
||||
|
||||
@ -17,13 +17,13 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
Transactionable interface {
|
||||
Tx(context.Context, func(context.Context, Storable) error) error
|
||||
Transactioner interface {
|
||||
Tx(context.Context, func(context.Context, Storer) error) error
|
||||
}
|
||||
|
||||
// Sortable interface combines interfaces of all supported store interfaces
|
||||
Storable interface {
|
||||
Transactionable
|
||||
Storer interface {
|
||||
Transactioner
|
||||
|
||||
{{ range .Definitions -}}
|
||||
{{ export .Types.Plural }}
|
||||
|
||||
@ -18,7 +18,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testAllGenerated(t *testing.T, s store.Storable) {
|
||||
func testAllGenerated(t *testing.T, s store.Storer) {
|
||||
{{- range . }}
|
||||
// Run generated tests for {{ .Types.Base }}
|
||||
t.Run({{ printf "%q" .Types.Base }}, func(t *testing.T) {
|
||||
|
||||
@ -23,7 +23,7 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func Provision(ctx context.Context, log *zap.Logger, s store.Storable) (err error) {
|
||||
func Provision(ctx context.Context, log *zap.Logger, s store.Storer) (err error) {
|
||||
var (
|
||||
provisioned bool
|
||||
readers []io.Reader
|
||||
@ -80,7 +80,7 @@ func notProvisioned(ctx context.Context) (bool, error) {
|
||||
}
|
||||
|
||||
// Updates default application directly in the store
|
||||
func makeDefaultApplications(ctx context.Context, log *zap.Logger, s store.Storable) error {
|
||||
func makeDefaultApplications(ctx context.Context, log *zap.Logger, s store.Storer) error {
|
||||
var (
|
||||
now = time.Now()
|
||||
aa, _, err = s.SearchApplications(ctx, types.ApplicationFilter{})
|
||||
|
||||
@ -7,14 +7,14 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
ConnectorFn func(ctx context.Context, dsn string) (s Storable, err error)
|
||||
ConnectorFn func(ctx context.Context, dsn string) (s Storer, err error)
|
||||
)
|
||||
|
||||
var (
|
||||
registered = make(map[string]ConnectorFn)
|
||||
)
|
||||
|
||||
func Connect(ctx context.Context, dsn string) (s Storable, err error) {
|
||||
func Connect(ctx context.Context, dsn string) (s Storer, err error) {
|
||||
var storeType = strings.SplitN(dsn, "://", 2)[0]
|
||||
if storeType == "" {
|
||||
// Backward compatibility
|
||||
|
||||
@ -40,13 +40,13 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
Transactionable interface {
|
||||
Tx(context.Context, func(context.Context, Storable) error) error
|
||||
Transactioner interface {
|
||||
Tx(context.Context, func(context.Context, Storer) error) error
|
||||
}
|
||||
|
||||
// Sortable interface combines interfaces of all supported store interfaces
|
||||
Storable interface {
|
||||
Transactionable
|
||||
Storer interface {
|
||||
Transactioner
|
||||
|
||||
Actionlogs
|
||||
Applications
|
||||
|
||||
@ -22,7 +22,7 @@ func init() {
|
||||
store.Register(Connect, "mysql")
|
||||
}
|
||||
|
||||
func Connect(ctx context.Context, dsn string) (store.Storable, error) {
|
||||
func Connect(ctx context.Context, dsn string) (store.Storer, error) {
|
||||
var (
|
||||
err error
|
||||
cfg *rdbms.Config
|
||||
|
||||
@ -22,7 +22,7 @@ func init() {
|
||||
store.Register(Connect, "postgresql", "postgres", "pgsql")
|
||||
}
|
||||
|
||||
func Connect(ctx context.Context, dsn string) (store.Storable, error) {
|
||||
func Connect(ctx context.Context, dsn string) (store.Storer, error) {
|
||||
var (
|
||||
err error
|
||||
cfg *rdbms.Config
|
||||
|
||||
@ -258,7 +258,7 @@ func (s Store) Exec(ctx context.Context, sqlizer squirrel.Sqlizer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s Store) Tx(ctx context.Context, fn func(context.Context, store.Storable) error) error {
|
||||
func (s Store) Tx(ctx context.Context, fn func(context.Context, store.Storer) error) error {
|
||||
return tx(ctx, s.db, s.config, nil, func(ctx context.Context, tx dbLayer) error {
|
||||
return fn(ctx, s.withTx(tx))
|
||||
})
|
||||
|
||||
@ -18,7 +18,7 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func Connect(ctx context.Context, dsn string) (store.Storable, error) {
|
||||
func Connect(ctx context.Context, dsn string) (store.Storer, error) {
|
||||
var (
|
||||
err error
|
||||
cfg *rdbms.Config
|
||||
@ -46,7 +46,7 @@ func Connect(ctx context.Context, dsn string) (store.Storable, error) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func ConnectInMemory(ctx context.Context) (s store.Storable, err error) {
|
||||
func ConnectInMemory(ctx context.Context) (s store.Storer, err error) {
|
||||
return Connect(ctx, "sqlite3://file::memory:?cache=shared&mode=memory")
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func testComposeCharts(t *testing.T, s store.Storable) {
|
||||
func testComposeCharts(t *testing.T, s store.Storer) {
|
||||
var (
|
||||
ctx = context.Background()
|
||||
req = require.New(t)
|
||||
|
||||
@ -39,7 +39,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testAllGenerated(t *testing.T, s store.Storable) {
|
||||
func testAllGenerated(t *testing.T, s store.Storer) {
|
||||
// Run generated tests for Actionlog
|
||||
t.Run("Actionlog", func(t *testing.T) {
|
||||
testActionlog(t, s)
|
||||
|
||||
@ -2,6 +2,6 @@ package store
|
||||
|
||||
import "context"
|
||||
|
||||
func Tx(ctx context.Context, s Storable, fn func(context.Context, Storable) error) error {
|
||||
func Tx(ctx context.Context, s Storer, fn func(context.Context, Storer) error) error {
|
||||
return s.Tx(ctx, fn)
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ type (
|
||||
actionlog actionlog.Recorder
|
||||
files files.Store
|
||||
ac attachmentAccessController
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
attachmentAccessController interface {
|
||||
|
||||
@ -28,7 +28,7 @@ type (
|
||||
eventbus eventDispatcher
|
||||
|
||||
subscription authSubscriptionChecker
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
settings *types.AppSettings
|
||||
notifications AuthNotificationService
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ type (
|
||||
|
||||
user UserService
|
||||
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
roleAccessController interface {
|
||||
|
||||
@ -48,7 +48,7 @@ var (
|
||||
// DefaultNgStore is an interface to storage backend(s)
|
||||
// ng (next-gen) is a temporary prefix
|
||||
// so that we can differentiate between it and the file-only store
|
||||
DefaultNgStore ngStore.Storable
|
||||
DefaultNgStore ngStore.Storer
|
||||
|
||||
DefaultLogger *zap.Logger
|
||||
|
||||
@ -107,7 +107,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func Initialize(ctx context.Context, log *zap.Logger, s ngStore.Storable, c Config) (err error) {
|
||||
func Initialize(ctx context.Context, log *zap.Logger, s ngStore.Storer, c Config) (err error) {
|
||||
var (
|
||||
hcd = healthcheck.Defaults()
|
||||
)
|
||||
|
||||
@ -12,7 +12,7 @@ type (
|
||||
statistics struct {
|
||||
actionlog actionlog.Recorder
|
||||
ac statisticsAccessController
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
statisticsAccessController interface {
|
||||
|
||||
@ -38,7 +38,7 @@ type (
|
||||
ac userAccessController
|
||||
eventbus eventDispatcher
|
||||
|
||||
store store.Storable
|
||||
store store.Storer
|
||||
}
|
||||
|
||||
userAuth interface {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user