gimg: github.com/Leon2012/gimg Index | Files | Directories

package gimg

import "github.com/Leon2012/gimg"

Index

Package Files

zcache.go zcommon.go zconfig.go zhttpd.go zimage.go zlog.go zredisdb.go zscale.go zstorage.go zstorage_base.go zstorage_file.go zstorage_ssdb.go zutil.go

Constants

const (
    PROJECT_VERSION = "1.0.1"
    MAX_LINE        = 1024
    CACHE_KEY_SIZE  = 128
    RETRY_TIME_WAIT = 1000
    CACHE_MAX_SIZE  = 1048576 //1024*1024
    PATH_MAX_SIZE   = 512
)
const (
    Black = (iota + 30)
    Red
    Green
    Yellow
    Blue
    Magenta
    Cyan
    White
)

type AppConfig Uses

type AppConfig struct {
    System struct {
        IsDaemon    int
        Host        string
        Port        int
        Headers     string
        Etag        int
        LogOutput   string
        LogLevel    int
        LogName     string
        DisableArgs int
        Format      string
        Quality     int
    }

    Cache struct {
        Cache        int
        MemcacheHost string
        MemcachePort int
    }

    Storage struct {
        Mode         int
        SaveNew      int
        MaxSize      int
        AllowedTypes string
        ImgPath      string

        BeansdbHost string
        BeansdbPort int

        SsdbHost string
        SsdbPort int
    }
}

func LoadConfig Uses

func LoadConfig(cfgFile string) (AppConfig, error)

type Info Uses

type Info struct {
    Id      uint64
    Time    string
    Module  string
    Level   string
    Message string
    // contains filtered or unexported fields
}

func (*Info) Output Uses

func (i *Info) Output() string

type Worker Uses

type Worker struct {
    Minion  *log.Logger
    Color   int
    LogFile *os.File
}

func NewConsoleWorker Uses

func NewConsoleWorker(prefix string, flag int, color int) *Worker

func NewFileWorker Uses

func NewFileWorker(prefix string, flag int, color int, logFile *os.File) *Worker

func NewWorker Uses

func NewWorker(prefix string, flag int, color int, out io.Writer) *Worker

func (*Worker) Log Uses

func (w *Worker) Log(level string, calldepth int, info *Info) error

type ZBaseStorage Uses

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

type ZCache Uses

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

func NewCache Uses

func NewCache(h string, p int) *ZCache

func (*ZCache) DelCache Uses

func (z *ZCache) DelCache(key string) error

func (*ZCache) Exist Uses

func (z *ZCache) Exist(key string) bool

func (*ZCache) FindCache Uses

func (z *ZCache) FindCache(key string) (string, error)

func (*ZCache) FindCacheBin Uses

func (z *ZCache) FindCacheBin(key string) ([]byte, error)

func (*ZCache) ReTry Uses

func (z *ZCache) ReTry()

func (*ZCache) SetCache Uses

func (z *ZCache) SetCache(k string, v string) error

func (*ZCache) SetCacheBin Uses

func (z *ZCache) SetCacheBin(k string, v []byte) error

type ZContext Uses

type ZContext struct {
    Config AppConfig
    Logger *ZLogger
    Cache  *ZCache
    Image  *ZImage
    Redis  *ZRedisDB
}

func NewContext Uses

func NewContext(cfgFile string) (*ZContext, error)

func (*ZContext) Release Uses

func (z *ZContext) Release()

type ZFileStorage Uses

type ZFileStorage struct {
    sync.RWMutex
    *ZBaseStorage
    // contains filtered or unexported fields
}

func NewFileStorage Uses

func NewFileStorage(c *ZContext) *ZFileStorage

func (*ZFileStorage) GetImage Uses

func (z *ZFileStorage) GetImage(request *ZRequest) ([]byte, error)

func (*ZFileStorage) InfoImage Uses

func (z *ZFileStorage) InfoImage(md5 string) (*ZImageInfo, error)

func (*ZFileStorage) NewImage Uses

func (z *ZFileStorage) NewImage(saveName string, data []byte) error

func (*ZFileStorage) SaveImage Uses

func (z *ZFileStorage) SaveImage(data []byte) (string, error)

type ZHttpd Uses

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

func NewHttpd Uses

func NewHttpd(c *ZContext) *ZHttpd

func (*ZHttpd) ServeHTTP Uses

func (z *ZHttpd) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ZImage Uses

type ZImage struct {
    MW *imagick.MagickWand
}

func NewImage Uses

func NewImage() *ZImage

func (*ZImage) Destroy Uses

func (z *ZImage) Destroy()

type ZImageInfo Uses

type ZImageInfo struct {
    Size    int    `json:"size"`
    Width   int    `json:"width"`
    Height  int    `json:"height"`
    Quality int    `json:"quality"`
    Format  string `json:"format"`
}

type ZLogger Uses

type ZLogger struct {
    Module string
    Worker *Worker
}

func NewDailyLogger Uses

func NewDailyLogger(module string, color int, logPath string) (*ZLogger, error)

func NewFileLogger Uses

func NewFileLogger(module string, color int, logFile string) (*ZLogger, error)

func NewLogger Uses

func NewLogger(module string, color int) (*ZLogger, error)

func (*ZLogger) Close Uses

func (l *ZLogger) Close()

func (*ZLogger) Critical Uses

func (l *ZLogger) Critical(format string, v ...interface{})

func (*ZLogger) Debug Uses

func (l *ZLogger) Debug(format string, v ...interface{})

func (*ZLogger) Error Uses

func (l *ZLogger) Error(format string, v ...interface{})

func (*ZLogger) Fatal Uses

func (l *ZLogger) Fatal(format string, v ...interface{})

func (*ZLogger) Info Uses

func (l *ZLogger) Info(format string, v ...interface{})

func (*ZLogger) Log Uses

func (l *ZLogger) Log(lvl string, message string)

func (*ZLogger) Notice Uses

func (l *ZLogger) Notice(format string, v ...interface{})

func (*ZLogger) Panic Uses

func (l *ZLogger) Panic(format string, v ...interface{})

func (*ZLogger) Strack Uses

func (l *ZLogger) Strack(format string, v ...interface{})

func (*ZLogger) Warning Uses

func (l *ZLogger) Warning(format string, v ...interface{})

type ZRedisDB Uses

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

func NewRedisDB Uses

func NewRedisDB(s string, p int) (*ZRedisDB, error)

func (*ZRedisDB) Close Uses

func (z *ZRedisDB) Close()

func (*ZRedisDB) Do Uses

func (z *ZRedisDB) Do(commandName string, args ...interface{}) (interface{}, error)

func (*ZRedisDB) Exist Uses

func (z *ZRedisDB) Exist(key string) bool

func (*ZRedisDB) Flush Uses

func (z *ZRedisDB) Flush()

func (*ZRedisDB) Get Uses

func (z *ZRedisDB) Get(key string) ([]byte, error)

func (*ZRedisDB) Send Uses

func (z *ZRedisDB) Send(commandName string, args ...interface{}) error

type ZRequest Uses

type ZRequest struct {
    Md5        string
    ImageType  string
    Width      int
    Height     int
    Proportion int
    Gary       int
    X          int
    Y          int
    Rotate     int
    Format     string
    Save       int
    Quality    int
}

type ZSSDBStorage Uses

type ZSSDBStorage struct {
    *ZBaseStorage
}

func NewSSDBStorage Uses

func NewSSDBStorage(c *ZContext) *ZSSDBStorage

func (*ZSSDBStorage) GetImage Uses

func (z *ZSSDBStorage) GetImage(request *ZRequest) ([]byte, error)

func (*ZSSDBStorage) InfoImage Uses

func (z *ZSSDBStorage) InfoImage(md5 string) (*ZImageInfo, error)

func (*ZSSDBStorage) SaveImage Uses

func (z *ZSSDBStorage) SaveImage(data []byte) (string, error)

type ZStorage Uses

type ZStorage interface {
    SaveImage(data []byte) (string, error)
    //NewImage(saveName string, data []byte) error
    GetImage(request *ZRequest) ([]byte, error)
    InfoImage(md5 string) (*ZImageInfo, error)
}

Directories

PathSynopsis
build

Package gimg imports 27 packages (graph) and is imported by 1 packages. Updated 2016-07-16. Refresh now. Tools for package owners.