Documentation ¶
Index ¶
- Constants
- Variables
- func CheckVerificationCode(uniqueDesc string, receiver MailAddress, checkCode int) bool
- func ClearVerificationCodes()
- func Close() error
- func ConfigToDisk() error
- func ConsumeTaskIfNeeded()
- func GenerateVerificationCode(uniqueDesc string, receiver MailAddress) int
- func Init()
- func InitTicker()
- func InitVerify()
- func MultiError(errs []error) error
- func ResetStorageIndexFromDisk() error
- func ResetVerificationCodes()
- func RunEveryMinute()
- func RunEveryTenMinute()
- func SendVerificationCode(projectName string, receiver MailAddress, checkCode int) error
- func SendVerificationCodeWithSmtpAndProject(smtp *Smtp, project Project, projectName string, receiver MailAddress, ...) error
- func SetConfigPath(path string)
- func StorgaeClearIfNeed(option Option) error
- type Config
- type MailAddress
- type Option
- type Project
- func (project *Project) AppendToReceivers(receiver MailAddress)
- func (project *Project) AppendToReceiversWithCheck(receiver MailAddress) error
- func (project *Project) ConvertReceiversToStringArray() []string
- func (project *Project) ExistInReceivers(receiver MailAddress) bool
- func (project *Project) ReceiverMatch(receiver MailAddress) error
- func (project *Project) Send(bytes []byte) error
- type ProjectUniqueKey
- type Smtp
- type Storgae
- func (storgae *Storgae) ClearBytesUntil(len int64, option Option) error
- func (storgae *Storgae) ClearUnixNanoUntil(unixNano int64, option Option) error
- func (storgae *Storgae) Delete(item *StorgaeIndexItem) error
- func (storgae *Storgae) Init() error
- func (storgae *Storgae) LoadStorageIndexFromDisk() error
- func (storgae *Storgae) PrepareByte(len int)
- func (storgae *Storgae) Read(project *Project) ([]StorgaeHTML, error)
- func (storgae *Storgae) Write(project *Project, html []byte) error
- type StorgaeHTML
- type StorgaeIndex
- type StorgaeIndexItem
- type StorgaeIndexItemArray
- type Strategy
- type Task
- type TaskQueue
- func (taskQueue *TaskQueue) ConsumeTaskIfNeeded(unixNano int64, storageDataPath string, projects map[ProjectUniqueKey]*Project, ...) error
- func (taskQueue *TaskQueue) Len() int
- func (taskQueue *TaskQueue) Less(i, j int) bool
- func (taskQueue *TaskQueue) Pop() interface{}
- func (taskQueue *TaskQueue) PopTask() *Task
- func (taskQueue *TaskQueue) Push(x interface{})
- func (taskQueue *TaskQueue) PushTask(task *Task)
- func (taskQueue *TaskQueue) SubmitTask(task *Task) error
- func (taskQueue *TaskQueue) Swap(i, j int)
- func (taskQueue *TaskQueue) TopTask() *Task
Constants ¶
View Source
const DAY_NANOSECOND = 24 * 60 * 60 * 1e9
View Source
const HOUR_NANOSECOND = 60 * 60 * 1e9
View Source
const MINUTE_NANOSECOND = 60 * 1e9
Variables ¶
View Source
var CONFIG_PATH = "./config.json"
View Source
var LastRandom = make([]byte, 16)
View Source
var OptionContinueIfDeleteSingleFileError = Option(1)
Functions ¶
func CheckVerificationCode ¶
func CheckVerificationCode(uniqueDesc string, receiver MailAddress, checkCode int) bool
func ClearVerificationCodes ¶
func ClearVerificationCodes()
func ConfigToDisk ¶
func ConfigToDisk() error
func ConsumeTaskIfNeeded ¶
func ConsumeTaskIfNeeded()
func GenerateVerificationCode ¶
func GenerateVerificationCode(uniqueDesc string, receiver MailAddress) int
func InitTicker ¶
func InitTicker()
func InitVerify ¶
func InitVerify()
func MultiError ¶
func ResetStorageIndexFromDisk ¶
func ResetStorageIndexFromDisk() error
func ResetVerificationCodes ¶
func ResetVerificationCodes()
func RunEveryMinute ¶
func RunEveryMinute()
func RunEveryTenMinute ¶
func RunEveryTenMinute()
func SendVerificationCode ¶
func SendVerificationCode(projectName string, receiver MailAddress, checkCode int) error
func SetConfigPath ¶
func SetConfigPath(path string)
func StorgaeClearIfNeed ¶
Types ¶
type Config ¶
type Config struct { Smtp *Smtp `json:"Smtp"` Storgae Storgae `json:"Storgae"` Admin Project `json:"Admin"` Passwords map[string]string `json:"Passwords"` PenddingTaskSavePath string `json:"PenddingTaskSavePath"` Tasks []string `json:"Tasks"` TaskQueue *TaskQueue `json:"-"` MailAddressToProjectUniqueKey map[MailAddress][]ProjectUniqueKey `json:"EmailAddressToProjectUniqueKey"` Projects map[ProjectUniqueKey]*Project `json:"Projects"` }
type MailAddress ¶
type MailAddress string
type Project ¶
type Project struct { ProjectUniqueKey ProjectUniqueKey `json:"-"` Strategy Strategy `json:"Strategy"` Name string `json:"Name"` Admin []MailAddress `json:"Admin"` ReceiverMustMatch string `json:"ReceiverMustMatch"` Receivers []MailAddress `json:"Receivers"` Sender string `json:"Sender"` Subject string `json:"Subject"` }
func (*Project) AppendToReceivers ¶
func (project *Project) AppendToReceivers(receiver MailAddress)
func (*Project) AppendToReceiversWithCheck ¶
func (project *Project) AppendToReceiversWithCheck(receiver MailAddress) error
func (*Project) ConvertReceiversToStringArray ¶
func (*Project) ExistInReceivers ¶
func (project *Project) ExistInReceivers(receiver MailAddress) bool
func (*Project) ReceiverMatch ¶
func (project *Project) ReceiverMatch(receiver MailAddress) error
type ProjectUniqueKey ¶
type ProjectUniqueKey string
type Smtp ¶
type Storgae ¶
type Storgae struct { UsedBytes int64 `json:"-"` DataPath string `json:"DataPath"` NeedClearBytes int64 `json:"NeedClearBytes"` NeverExceedBytes int64 `json:"NeverExceedBytes"` SavedSecond int64 `json:"SavedSecond"` Index StorgaeIndex `json:"-"` }
func (*Storgae) ClearBytesUntil ¶
func (*Storgae) ClearUnixNanoUntil ¶
func (*Storgae) Delete ¶
func (storgae *Storgae) Delete(item *StorgaeIndexItem) error
func (*Storgae) LoadStorageIndexFromDisk ¶
func (*Storgae) PrepareByte ¶
type StorgaeHTML ¶
type StorgaeIndex ¶
type StorgaeIndex struct {
Items *go_queue.ConcurrentQueue
}
type StorgaeIndexItem ¶
type StorgaeIndexItemArray ¶
type StorgaeIndexItemArray []StorgaeIndexItem
func (StorgaeIndexItemArray) Len ¶
func (array StorgaeIndexItemArray) Len() int
func (StorgaeIndexItemArray) Less ¶
func (array StorgaeIndexItemArray) Less(i, j int) bool
func (StorgaeIndexItemArray) Swap ¶
func (array StorgaeIndexItemArray) Swap(i, j int)
type Strategy ¶
type Strategy struct { OnlySendlatest bool `json:"OnlySendlatest"` Merge bool `json:"Merge"` Close bool `json:"Close"` Period string `json:"Period"` }
func (*Strategy) NextSendTime ¶
type Task ¶
type Task struct { ProjectUniqueKey ProjectUniqueKey `json:"ProjectUniqueKey"` SendUnixNano int64 `json:"SendUnixNano"` Hashcode string `json:"Hashcode"` Bytes []byte `json:"Bytes"` }
type TaskQueue ¶
type TaskQueue struct {
// contains filtered or unexported fields
}
func (*TaskQueue) ConsumeTaskIfNeeded ¶
func (taskQueue *TaskQueue) ConsumeTaskIfNeeded(unixNano int64, storageDataPath string, projects map[ProjectUniqueKey]*Project, smtp *Smtp) error
this method can only be called in smtp
func (*TaskQueue) SubmitTask ¶
Click to show internal directories.
Click to hide internal directories.