service

package
v0.0.0-...-1db0c7d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAtomicCounter

func NewAtomicCounter(etcd *datastore.EtcdStore) *atomicCounter

Types

type AtmoicCounterRepo

type AtmoicCounterRepo interface {
	DisplayCurrentRange() string
	// contains filtered or unexported methods
}

type CacheRepo

type CacheRepo struct {
	// contains filtered or unexported fields
}

CacheRepo implements the interface UrlCache

func NewCacheRepo

func NewCacheRepo(c *cache.Cache) *CacheRepo

func (*CacheRepo) GetUrl

func (c *CacheRepo) GetUrl(hash string) (*m.Url, error)

func (*CacheRepo) SetUrl

func (c *CacheRepo) SetUrl(u *m.Url) error

type Cassandra

type Cassandra struct {
	// contains filtered or unexported fields
}

func NewCassandra

func NewCassandra(cs *gocql.Session) *Cassandra

func (*Cassandra) GetUrl

func (c *Cassandra) GetUrl(hash string) (*m.Url, error)

func (*Cassandra) SetUrl

func (c *Cassandra) SetUrl(u *m.Url) error

type PrevModRevision

type PrevModRevision struct {
	ModRevision int64
}

type UrlCache

type UrlCache interface {
	SetUrl(url *m.Url) error
	GetUrl(hash string) (*m.Url, error)
}

type UrlCsdra

type UrlCsdra interface {
	SetUrl(url *m.Url) error
	GetUrl(hash string) (*m.Url, error)
}

type UrlRepository

type UrlRepository interface {
	SaveUrl(longUrl string, expireAt int64) (string, error)
	GetUrlByHash(hash string) (*m.Url, error)
}

type UrlService

type UrlService struct {
	AC AtmoicCounterRepo
	// contains filtered or unexported fields
}

func NewUrlService

func NewUrlService(csdra UrlCsdra, uc UrlCache, es *datastore.EtcdStore) *UrlService

func (*UrlService) GetUrlByHash

func (s *UrlService) GetUrlByHash(hash string) (u *m.Url, err error)

func (*UrlService) SaveUrl

func (s *UrlService) SaveUrl(longUrl string, exipreAt int64) (hash string, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL