diff --git a/cmd/showonce/run.go b/cmd/showonce/run.go index 88cc27c..09808ac 100644 --- a/cmd/showonce/run.go +++ b/cmd/showonce/run.go @@ -143,13 +143,14 @@ func Run(ctx context.Context, exitFunc func(code int)) { MaxHeaderBytes: 1 << 20, } - // creating a listener for server + // creating a listener for GRPC server var listenerPub net.Listener listenerPub, err = net.Listen("tcp", cfg.ListenGRPC) if err != nil { return } - // creating a listener for server + + // creating a listener for HTTP server var listener net.Listener listener, err = net.Listen("tcp", cfg.Listen) if err != nil { diff --git a/showonce.go b/showonce.go index 31168dc..e3c6d89 100644 --- a/showonce.go +++ b/showonce.go @@ -20,11 +20,11 @@ var errMissingMetadata = status.Errorf(codes.InvalidArgument, "no incoming metad // PublicServiceImpl - реализация PublicService. type PublicServiceImpl struct { gen.UnimplementedPublicServiceServer - Store storage.StorageIface + Store storage.Iface } // NewPublicService - создать PublicService. -func NewPublicService(db storage.StorageIface) *PublicServiceImpl { +func NewPublicService(db storage.Iface) *PublicServiceImpl { return &PublicServiceImpl{Store: db} } @@ -43,11 +43,11 @@ func (service PublicServiceImpl) GetData(_ context.Context, id *gen.ItemId) (*ge // PrivateServiceImpl - реадизация PrivateService. type PrivateServiceImpl struct { gen.UnimplementedPrivateServiceServer - Store storage.StorageIface + Store storage.Iface } // NewPrivateService - создать PrivateService. -func NewPrivateService(db storage.StorageIface) *PrivateServiceImpl { +func NewPrivateService(db storage.Iface) *PrivateServiceImpl { return &PrivateServiceImpl{Store: db} } diff --git a/storage/cache/cache.go b/storage/cache/cache.go index ad9687b..2b9e7a4 100644 --- a/storage/cache/cache.go +++ b/storage/cache/cache.go @@ -1,3 +1,4 @@ +// Package cache implements cache storage. package cache import ( @@ -35,7 +36,7 @@ var ( ErrDataCorrupted = errors.New("item data was corrupted") ) -// NewStorage returns new Storage object. +// New returns new Storage object. func New(cfg Config) Storage { return Storage{ Meta: zcache.New[string, *gen.ItemMeta](cfg.MetaTTL, cfg.CleanupInterval), diff --git a/storage/storage.go b/storage/storage.go index 6441a0e..ad45a37 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -1,5 +1,6 @@ // DONT EDIT: Auto generated by ifacemaker +// Package storage hold Iface which all subpackages implements. package storage import ( @@ -7,8 +8,8 @@ import ( "github.com/oklog/ulid/v2" ) -// StorageIface makes users independant -type StorageIface interface { +// Iface makes users independent from storage implementation. +type Iface interface { // SetMeta prepares and saves item metadata and secret. SetMeta(owner string, req *gen.NewItemRequest) (*ulid.ULID, error) // GetMeta returns item metadata. @@ -20,4 +21,3 @@ type StorageIface interface { // Stats returns global and user's item counters. Stats(owner string) (*gen.StatsResponse, error) } -