Skip to content

Commit

Permalink
fix: typo adapter
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Louvigny <glouvigny@users.noreply.github.com>
  • Loading branch information
glouvigny committed Jul 29, 2021
1 parent b3f9b18 commit bc8d536
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go/framework/bertybridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func NewBridge(config *Config) (*Bridge, error) {
// setup notification manager
{
if nativeNotification := config.notifdriver; nativeNotification != nil {
b.notificationManager = newNotificationManagerAdaptater(b.logger, config.notifdriver)
b.notificationManager = newNotificationManagerAdapter(b.logger, config.notifdriver)
} else {
b.logger.Warn("no native notification set")
b.notificationManager = notification.NewLoggerManager(b.logger)
Expand Down
14 changes: 7 additions & 7 deletions go/framework/bertybridge/driver_notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ type noopNotificationDriver struct{}

func (*noopNotificationDriver) Post(*LocalNotification) error { return nil }

type notificationManagerAdaptater struct {
type notificationManagerAdapter struct {
logger *zap.Logger
driver NotificationDriver
}

// notificationManagerAdaptater is a NotificationManager
var _ notification.Manager = (*notificationManagerAdaptater)(nil)
// notificationManagerAdapter is a NotificationManager
var _ notification.Manager = (*notificationManagerAdapter)(nil)

func newNotificationManagerAdaptater(logger *zap.Logger, driver NotificationDriver) notification.Manager {
return &notificationManagerAdaptater{logger, driver}
func newNotificationManagerAdapter(logger *zap.Logger, driver NotificationDriver) notification.Manager {
return &notificationManagerAdapter{logger, driver}
}

func (a *notificationManagerAdaptater) Notify(notif *notification.Notification) error {
func (a *notificationManagerAdapter) Notify(notif *notification.Notification) error {
a.logger.Debug("notification triggered",
zap.String("title", notif.Title), zap.String("body", notif.Body))
return a.driver.Post(&LocalNotification{
Expand All @@ -41,7 +41,7 @@ func (a *notificationManagerAdaptater) Notify(notif *notification.Notification)
})
}

func (a *notificationManagerAdaptater) Schedule(notif *notification.Notification, interval time.Duration) error {
func (a *notificationManagerAdapter) Schedule(notif *notification.Notification, interval time.Duration) error {
a.logger.Debug("notification scheduled",
zap.String("title", notif.Title), zap.String("body", notif.Body))
return a.driver.Post(&LocalNotification{
Expand Down
2 changes: 1 addition & 1 deletion go/internal/initutil/ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (m *Manager) getLocalIPFS() (ipfsutil.ExtendedCoreAPI, *ipfs_core.IpfsNode,
}

psapi := ipfsutil.NewPubSubAPI(m.getContext(), logger.Named("ps"), m.Node.Protocol.discovery, m.Node.Protocol.pubsub)
m.Node.Protocol.ipfsAPI = ipfsutil.InjectPubSubCoreAPIExtendedAdaptater(m.Node.Protocol.ipfsAPI, psapi)
m.Node.Protocol.ipfsAPI = ipfsutil.InjectPubSubCoreAPIExtendedAdapter(m.Node.Protocol.ipfsAPI, psapi)

// enable conn logger
ipfsutil.EnableConnLogger(m.getContext(), logger, m.Node.Protocol.ipfsNode.PeerHost)
Expand Down
14 changes: 7 additions & 7 deletions go/internal/ipfsutil/pubsub_adaptater.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ import (
ipfs_interface "github.com/ipfs/interface-go-ipfs-core"
)

type pubsubCoreAPIAdaptater struct {
type pubsubCoreAPIAdapter struct {
ipfs_interface.PubSubAPI

ipfs_interface.CoreAPI
}

func (ps *pubsubCoreAPIAdaptater) PubSub() ipfs_interface.PubSubAPI {
func (ps *pubsubCoreAPIAdapter) PubSub() ipfs_interface.PubSubAPI {
return ps.PubSubAPI
}

func InjectPubSubAPI(api ipfs_interface.CoreAPI, ps ipfs_interface.PubSubAPI) ipfs_interface.CoreAPI {
return &pubsubCoreAPIAdaptater{
return &pubsubCoreAPIAdapter{
PubSubAPI: ps,
CoreAPI: api,
}
}

type pubsubExtendedCoreAPIAdaptater struct {
type pubsubExtendedCoreAPIAdapter struct {
ipfs_interface.PubSubAPI

ExtendedCoreAPI
}

func (ps *pubsubExtendedCoreAPIAdaptater) PubSub() ipfs_interface.PubSubAPI {
func (ps *pubsubExtendedCoreAPIAdapter) PubSub() ipfs_interface.PubSubAPI {
return ps.PubSubAPI
}

func InjectPubSubCoreAPIExtendedAdaptater(exapi ExtendedCoreAPI, ps ipfs_interface.PubSubAPI) ExtendedCoreAPI {
return &pubsubExtendedCoreAPIAdaptater{
func InjectPubSubCoreAPIExtendedAdapter(exapi ExtendedCoreAPI, ps ipfs_interface.PubSubAPI) ExtendedCoreAPI {
return &pubsubExtendedCoreAPIAdapter{
PubSubAPI: ps,
ExtendedCoreAPI: exapi,
}
Expand Down
2 changes: 1 addition & 1 deletion go/internal/ipfsutil/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func TestingCoreAPIUsingMockNet(ctx context.Context, t testing.TB, opts *Testing
require.NoError(t, err, "unable to extend core api from node")

psapi := NewPubSubAPI(ctx, opts.Logger, disc, ps)
exapi = InjectPubSubCoreAPIExtendedAdaptater(exapi, psapi)
exapi = InjectPubSubCoreAPIExtendedAdapter(exapi, psapi)
EnableConnLogger(ctx, opts.Logger, mnode.PeerHost())

api := &coreAPIMock{
Expand Down

0 comments on commit bc8d536

Please sign in to comment.