bolt

package
v0.0.0-...-6e9cc21 Latest Latest
Warning

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

Go to latest
Published: May 6, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package bolt is a generated protocol buffer package.

It is generated from these files:

bolt.proto

It has these top-level messages:

Job
Playlist
Track
User

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Path          string
	Now           func() time.Time
	GenerateToken func() string
	// contains filtered or unexported fields
}

DB represents a handle to a Bolt database.

func NewDB

func NewDB() *DB

NewDB returns a new instance of DB.

func (*DB) Begin

func (db *DB) Begin(ctx context.Context, writable bool) (*Tx, error)

Begin starts a new transaction.

func (*DB) BeginAuth

func (db *DB) BeginAuth(ctx context.Context, writable bool) (*Tx, error)

BeginAuth starts a new transaction and verifies that a user is authenticated.

func (*DB) Close

func (db *DB) Close() error

Close closes the database.

func (*DB) Open

func (db *DB) Open() error

Open opens and initializes the database.

type Job

type Job struct {
	ID         int64  `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	OwnerID    int64  `protobuf:"varint,2,opt,name=OwnerID,proto3" json:"OwnerID,omitempty"`
	Type       string `protobuf:"bytes,3,opt,name=Type,proto3" json:"Type,omitempty"`
	Status     string `protobuf:"bytes,4,opt,name=Status,proto3" json:"Status,omitempty"`
	PlaylistID int64  `protobuf:"varint,5,opt,name=PlaylistID,proto3" json:"PlaylistID,omitempty"`
	Title      string `protobuf:"bytes,10,opt,name=Title,proto3" json:"Title,omitempty"`
	URL        string `protobuf:"bytes,6,opt,name=URL,proto3" json:"URL,omitempty"`
	Text       string `protobuf:"bytes,11,opt,name=Text,proto3" json:"Text,omitempty"`
	Error      string `protobuf:"bytes,7,opt,name=Error,proto3" json:"Error,omitempty"`
	CreatedAt  int64  `protobuf:"varint,8,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt  int64  `protobuf:"varint,9,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func (*Job) Descriptor

func (*Job) Descriptor() ([]byte, []int)

func (*Job) ProtoMessage

func (*Job) ProtoMessage()

func (*Job) Reset

func (m *Job) Reset()

func (*Job) String

func (m *Job) String() string

type JobService

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

JobService represents a service for creating and processing jobs.

func NewJobService

func NewJobService(db *DB) *JobService

NewJobService returns a new instance of JobService.

func (*JobService) C

func (s *JobService) C() <-chan struct{}

C returns a channel that sends notifications of new jobs.

func (*JobService) CompleteJob

func (s *JobService) CompleteJob(ctx context.Context, id int, e error) error

CompleteJob marks a job as completed or failed.

func (*JobService) CreateJob

func (s *JobService) CreateJob(ctx context.Context, job *peapod.Job) error

CreateJob creates adds a job to the job queue.

func (*JobService) NextJob

func (s *JobService) NextJob(ctx context.Context) (*peapod.Job, error)

NextJob returns the next job in the job queue and marks it as started.

func (*JobService) ResetJobQueue

func (s *JobService) ResetJobQueue(ctx context.Context) error

ResetJobQueue resets all queued jobs to a pending status. This should be called when the process starts so that all jobs are restarted.

type Playlist

type Playlist struct {
	ID        int64  `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	OwnerID   int64  `protobuf:"varint,2,opt,name=OwnerID,proto3" json:"OwnerID,omitempty"`
	Token     string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"`
	Name      string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"`
	CreatedAt int64  `protobuf:"varint,5,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt int64  `protobuf:"varint,6,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func (*Playlist) Descriptor

func (*Playlist) Descriptor() ([]byte, []int)

func (*Playlist) ProtoMessage

func (*Playlist) ProtoMessage()

func (*Playlist) Reset

func (m *Playlist) Reset()

func (*Playlist) String

func (m *Playlist) String() string

type PlaylistService

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

PlaylistService represents a service to manage playlists.

func NewPlaylistService

func NewPlaylistService(db *DB) *PlaylistService

NewPlaylistService returns a new instance of PlaylistService.

func (*PlaylistService) FindPlaylistByID

func (s *PlaylistService) FindPlaylistByID(ctx context.Context, id int) (*peapod.Playlist, error)

FindPlaylistByID returns a playlist and its tracks by id.

func (*PlaylistService) FindPlaylistByToken

func (s *PlaylistService) FindPlaylistByToken(ctx context.Context, token string) (*peapod.Playlist, error)

FindPlaylistByToken returns a playlist and its tracks by token.

func (*PlaylistService) FindPlaylistsByUserID

func (s *PlaylistService) FindPlaylistsByUserID(ctx context.Context, id int) ([]*peapod.Playlist, error)

FindPlaylistsByUserID returns a list of all playlists for a user.

type Track

type Track struct {
	ID          int64  `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	PlaylistID  int64  `protobuf:"varint,2,opt,name=PlaylistID,proto3" json:"PlaylistID,omitempty"`
	Filename    string `protobuf:"bytes,3,opt,name=Filename,proto3" json:"Filename,omitempty"`
	ContentType string `protobuf:"bytes,4,opt,name=ContentType,proto3" json:"ContentType,omitempty"`
	Title       string `protobuf:"bytes,5,opt,name=Title,proto3" json:"Title,omitempty"`
	Description string `protobuf:"bytes,10,opt,name=Description,proto3" json:"Description,omitempty"`
	Duration    int64  `protobuf:"varint,6,opt,name=Duration,proto3" json:"Duration,omitempty"`
	FileSize    int64  `protobuf:"varint,7,opt,name=FileSize,proto3" json:"FileSize,omitempty"`
	CreatedAt   int64  `protobuf:"varint,8,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt   int64  `protobuf:"varint,9,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func (*Track) Descriptor

func (*Track) Descriptor() ([]byte, []int)

func (*Track) ProtoMessage

func (*Track) ProtoMessage()

func (*Track) Reset

func (m *Track) Reset()

func (*Track) String

func (m *Track) String() string

type TrackService

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

TrackService represents a service to manage tracks.

func NewTrackService

func NewTrackService(db *DB) *TrackService

NewTrackService returns a new instance of TrackService.

func (*TrackService) CreateTrack

func (s *TrackService) CreateTrack(ctx context.Context, track *peapod.Track) error

CreateTrack creates a new track on a playlist.

func (*TrackService) FindTrackByID

func (s *TrackService) FindTrackByID(ctx context.Context, id int) (*peapod.Track, error)

FindTrackByID returns a track by id.

type Tx

type Tx struct {
	*bolt.Tx
	Now           time.Time
	GenerateToken func() string
}

Tx is a wrapper for bolt.Tx.

type User

type User struct {
	ID           int64  `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	MobileNumber string `protobuf:"bytes,2,opt,name=MobileNumber,proto3" json:"MobileNumber,omitempty"`
	CreatedAt    int64  `protobuf:"varint,3,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt    int64  `protobuf:"varint,4,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func (*User) Descriptor

func (*User) Descriptor() ([]byte, []int)

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) Reset

func (m *User) Reset()

func (*User) String

func (m *User) String() string

type UserService

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

UserService represents a service to manage users.

func NewUserService

func NewUserService(db *DB) *UserService

NewUserService returns a new instance of UserService.

func (*UserService) CreateUser

func (s *UserService) CreateUser(ctx context.Context, user *peapod.User) error

CreateUser creates a new user.

func (*UserService) FindUserByID

func (s *UserService) FindUserByID(ctx context.Context, id int) (*peapod.User, error)

FindUserByID returns a user with a given id.

func (*UserService) FindUserByMobileNumber

func (s *UserService) FindUserByMobileNumber(ctx context.Context, mobileNumber string) (*peapod.User, error)

FindUserByMobileNumber returns a user by mobile number.

Jump to

Keyboard shortcuts

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