Documentation
¶
Overview ¶
Package tasks implements the core Pixur business logic.
Index ¶
- func AuthTokenFromCtx(ctx context.Context) (token string, ok bool)
- func CtxFromAuthToken(ctx context.Context, token string) context.Context
- func CtxFromTestConfig(ctx context.Context, conf *schema.Configuration) context.Context
- func CtxFromUserToken(ctx context.Context, userId, tokenId int64) context.Context
- func GetConfiguration(ctx context.Context) (*schema.Configuration, status.S)
- type AddPicCommentTask
- type AddPicCommentVoteTask
- type AddPicTagsTask
- type AddPicVoteTask
- type AuthUserTask
- type CreateCustomDataTask
- type CreateUserTask
- type FindCustomDataTask
- type FindPicCommentVotesTask
- type FindSchedPicsTask
- type FindSimilarPicsTask
- type FindUserEventsTask
- type HardDeletePicTask
- type IncrementViewCountTask
- type LoadConfigurationTask
- type LookupPicTask
- type LookupPicVoteTask
- type LookupUserTask
- type PicCommentTree
- type PurgePicTask
- type ReadIndexPicsTask
- type SoftDeletePicTask
- type Task
- type TaskRunner
- type UnauthUserTask
- type UpdatePicTagTask
- type UpdateUserTask
- type UpsertPicTask
- type UserToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CtxFromTestConfig ¶
func CtxFromUserToken ¶
func GetConfiguration ¶
Types ¶
type AddPicCommentTask ¶
type AddPicCommentTask struct {
// Deps
Beg tab.JobBeginner
Now func() time.Time
// Inputs
PicId int64
CommentParentId int64
Text string
// Ext is additional extra data associated with this comment.
Ext map[string]*any.Any
// Outs
UnfilteredPicComment *schema.PicComment
PicComment *schema.PicComment
}
type AddPicCommentVoteTask ¶
type AddPicCommentVoteTask struct {
Beg tab.JobBeginner
Now func() time.Time
PicId int64
CommentId int64
Vote schema.PicCommentVote_Vote
Ext map[string]*anypb.Any
// Result
PicCommentVote *schema.PicCommentVote
}
type AddPicTagsTask ¶
type AddPicVoteTask ¶
type AuthUserTask ¶
type CreateCustomDataTask ¶
type CreateCustomDataTask struct {
Beg tab.JobBeginner
Now func() time.Time
KeyType, Key1, Key2, Key3, Key4, Key5 int64
Capability []schema.User_Capability
Data *anypb.Any
}
type CreateUserTask ¶
type CreateUserTask struct {
// Deps
Beg tab.JobBeginner
Now func() time.Time
HashPassword func([]byte) ([]byte, error)
// Inputs
Ident string
Secret string
// Special input that overrides the defaults. Used for site bootstrapping.
Capability []schema.User_Capability
// Ext is additional extra data associated with this user.
Ext map[string]*any.Any
// Results
CreatedUser *schema.User
}
type FindCustomDataTask ¶
type FindCustomDataTask struct {
Beg tab.JobBeginner
Now func() time.Time
KeyType int64
KeyPrefix []int64
Capability []schema.User_Capability
Data []*schema.CustomData
}
type FindPicCommentVotesTask ¶
type FindPicCommentVotesTask struct {
// Deps
Beg tab.JobBeginner
Now func() time.Time
// Inputs
PicId int64
CommentId *int64
ObjectUserId *int64
// Results
PicCommentVote []*schema.PicCommentVote
}
type FindSchedPicsTask ¶
type FindSimilarPicsTask ¶
type FindUserEventsTask ¶
type FindUserEventsTask struct {
Beg tab.JobBeginner
Now func() time.Time
// Input
MaxUserEvents int64
ObjectUserId int64
StartUserId, StartCreatedTs, StartIndex int64
Ascending bool
// Output
UserEvents []*schema.UserEvent
NextUserId, NextCreatedTs, NextIndex int64
PrevUserId, PrevCreatedTs, PrevIndex int64
}
type HardDeletePicTask ¶
type IncrementViewCountTask ¶
type IncrementViewCountTask struct {
// Deps
Beg tab.JobBeginner
Now func() time.Time
// Inputs
PicId int64
}
type LoadConfigurationTask ¶
type LoadConfigurationTask struct {
Beg db.Beginner
// If non-nil, this will override any other configuration that might be used.
Config *schema.Configuration
}
type LookupPicTask ¶
type LookupPicTask struct {
// Deps
Beg tab.JobBeginner
Now func() time.Time
// Inputs
PicId int64
// If true, check if the user is allowed to read extended pic info. The data will be included
// regardless of if this is set, and the caller should remove the extended data.
CheckReadPicExtCap bool
// If true, check if the user is allowed to read extended comment info. The data will be included
// regardless of if this is set, and the caller should remove the extended data.
CheckReadPicCommentExtCap bool
// If true, check if the user is allowed to read extended pic tag info. The data will be included
// regardless of if this is set, and the caller should remove the extended data.
CheckReadPicTagExtCap bool
// Results
UnfilteredPic *schema.Pic
Pic *schema.Pic
PicTags []*schema.PicTag
PicCommentTree *PicCommentTree
}
type LookupPicVoteTask ¶
type LookupUserTask ¶
type PicCommentTree ¶
type PicCommentTree struct {
PicComment *schema.PicComment
Children []*PicCommentTree
}
func (*PicCommentTree) String ¶
func (pct *PicCommentTree) String() string
type PurgePicTask ¶
type ReadIndexPicsTask ¶
type ReadIndexPicsTask struct {
// Deps
Beg tab.JobBeginner
Now func() time.Time
// Inputs
// Only get pics with Pic Id <= than this. If unset, the latest pics will be returned.
StartId int64
// MaxPics is the maximum number of pics to return. Note that the number of pictures returned
// may be less than the number requested. If unset, a default is used.
MaxPics int64
// Ascending determines the order of pics returned.
Ascending bool
// Results
UnfilteredPics []*schema.Pic
// Same as pics, but with User info removed based on capability
Pics []*schema.Pic
NextId, PrevId int64
}
type SoftDeletePicTask ¶
type SoftDeletePicTask struct {
// deps
Beg tab.JobBeginner
Now func() time.Time
// input
PicId int64
// Represents when this Pic can be hard deleted. Optional.
PendingDeletionTime *time.Time
// Why is this being deleted
Reason schema.Pic_DeletionStatus_Reason
Details string
// Can this picture ever be re uploaded?
Temporary bool
}
type TaskRunner ¶
type TaskRunner struct {
// contains filtered or unexported fields
}
func TestTaskRunner ¶
type UnauthUserTask ¶
type UnauthUserTask struct {
// Deps
Beg tab.JobBeginner
Now func() time.Time
// Inputs
UserId int64
TokenId int64
}
TODO: add tests
type UpdatePicTagTask ¶
type UpdateUserTask ¶
type UpdateUserTask struct {
// Deps
Beg tab.JobBeginner
Now func() time.Time
// Inputs
ObjectUserId int64
Version int64
// Capabilities to add
SetCapability []schema.User_Capability
// Capabilities to remove
ClearCapability []schema.User_Capability
// Outputs
ObjectUser *schema.User
}
type UpsertPicTask ¶
type UpsertPicTask struct {
// Deps
PixPath string
Beg tab.JobBeginner
HTTPClient *http.Client
// os functions
TempFile func(dir, prefix string) (*os.File, error)
Rename func(oldpath, newpath string) error
MkdirAll func(path string, perm os.FileMode) error
Now func() time.Time
Remove func(name string) error
// Inputs
FileURL, FileURLReferrer string
File readerAtReadSeeker
Md5Hash []byte
// If the name is absent, UpsertPicTask will try to derive a name automatically from the FileURL.
FileName string
// Ext is additional extra data associated with this pic. If a key is present in both the
// new pic and the existing pic, Upsert will fail.
Ext map[string]*any.Any
// Results
UnfilteredCreatedPic *schema.Pic
CreatedPic *schema.Pic
}
UpsertPicTask inserts or updates a pic with the provided information.
Source Files
¶
- add_pic_comment_task.go
- add_pic_comment_vote_task.go
- add_pic_tags_task.go
- add_pic_vote.go
- auth.go
- auth_user_task.go
- authctx.go
- configuration.go
- create_custom_data_task.go
- create_user_task.go
- find_custom_data_task.go
- find_pic_comment_votes_task.go
- find_sched_pics_task.go
- find_similar_pics_task.go
- find_user_events_task.go
- hard_delete_pic_task.go
- increment_view_count_task.go
- lookup_pic_task.go
- lookup_pic_vote_task.go
- lookup_user_task.go
- purge_pic_task.go
- read_index_pics_task.go
- soft_delete_pic_task.go
- task.go
- task_runner.go
- unauth_user_task.go
- update_pic_tag_task.go
- update_user_task.go
- upsert_pic_task.go
Click to show internal directories.
Click to hide internal directories.