model

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileSystemTableName = "filesystem"
)
View Source
const FsCacheTableName = "fs_cache"
View Source
const (
	LinkTableName = "link"
)
View Source
const TimeFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func CacheID

func CacheID(clusterID, nodeName, CacheDir, fsID string) string

Types

type FSCache

type FSCache struct {
	PK          int64          `json:"-" gorm:"primaryKey;autoIncrement"`
	CacheID     string         `json:"cacheID" gorm:"type:varchar(36);column:cache_id"`
	CacheHashID string         `json:"cacheHashID" gorm:"type:varchar(36);column:cache_hash_id"`
	FsID        string         `json:"fsID" gorm:"type:varchar(36);column:fs_id"`
	CacheDir    string         `json:"cacheDir" gorm:"type:varchar(4096);column:cache_dir"`
	NodeName    string         `json:"nodename" gorm:"type:varchar(256);column:nodename"`
	UsedSize    int            `json:"usedSize" gorm:"type:bigint(20);column:usedsize"`
	ClusterID   string         `json:"-"   gorm:"column:cluster_id;default:''"`
	CreatedAt   time.Time      `json:"-"`
	UpdatedAt   time.Time      `json:"-"`
	DeletedAt   gorm.DeletedAt `json:"-"`
}

func (*FSCache) BeforeSave

func (c *FSCache) BeforeSave(*gorm.DB) error

func (*FSCache) TableName

func (c *FSCache) TableName() string

type FSCacheConfig

type FSCacheConfig struct {
	PK                      int64                  `json:"-"                   gorm:"primaryKey;autoIncrement"`
	FsID                    string                 `json:"fsID"                gorm:"type:varchar(36);unique_index"`
	CacheDir                string                 `json:"cacheDir"`
	Quota                   int                    `json:"quota"`
	MetaDriver              string                 `json:"metaDriver"`
	BlockSize               int                    `json:"blockSize"`
	Debug                   bool                   `json:"debug"`
	NodeAffinityJson        string                 `json:"-"                   gorm:"column:node_affinity;type:text;default:'{}'"`
	NodeAffinityMap         map[string]interface{} `json:"nodeAffinity"        gorm:"-"`
	NodeTaintTolerationJson string                 `json:"-"                   gorm:"column:node_tainttoleration;type:text;default:'{}'"`
	NodeTaintTolerationMap  map[string]interface{} `json:"nodeTaintToleration" gorm:"-"`
	ExtraConfigJson         string                 `json:"-"                   gorm:"column:extra_config;type:text;default:'{}'"`
	ExtraConfigMap          map[string]string      `json:"extraConfig"         gorm:"-"`
	CreateTime              string                 `json:"createTime"           gorm:"-"`
	UpdateTime              string                 `json:"updateTime,omitempty" gorm:"-"`
	CreatedAt               time.Time              `json:"-"`
	UpdatedAt               time.Time              `json:"-"`
	DeletedAt               gorm.DeletedAt         `json:"-"`
}

func (*FSCacheConfig) AfterFind

func (s *FSCacheConfig) AfterFind(*gorm.DB) error

func (*FSCacheConfig) BeforeSave

func (s *FSCacheConfig) BeforeSave(*gorm.DB) error

func (*FSCacheConfig) TableName

func (s *FSCacheConfig) TableName() string

type FileSystem

type FileSystem struct {
	Model
	Name                    string            `json:"name"`
	Type                    string            `json:"type"`
	ServerAddress           string            `json:"serverAddress"`
	SubPath                 string            `json:"subPath" gorm:"column:subpath"`
	PropertiesJson          string            `json:"-" gorm:"column:properties;type:text;default:'{}'"`
	PropertiesMap           map[string]string `json:"properties" gorm:"-"`
	UserName                string            `json:"userName"`
	IndependentMountProcess bool              `json:"independentMountProcess"`
}

FileSystem defined file system model, which can be used to create file system

func (*FileSystem) AfterFind

func (s *FileSystem) AfterFind(*gorm.DB) error

AfterFind is the callback methods doing after the find file system

func (*FileSystem) BeforeSave

func (s *FileSystem) BeforeSave(*gorm.DB) error

BeforeSave is the callback methods for saving file system

func (FileSystem) TableName

func (FileSystem) TableName() string

type Grant

type Grant struct {
	Pk           int64          `json:"-" gorm:"primaryKey;autoIncrement"`
	ID           string         `json:"grantID" gorm:"uniqueIndex"`
	UserName     string         `json:"userName"`
	ResourceType string         `json:"resourceType"`
	ResourceID   string         `json:"resourceID"`
	CreatedAt    time.Time      `json:"createTime"`
	UpdatedAt    time.Time      `json:"updateTime,omitempty"`
	DeletedAt    gorm.DeletedAt `json:"-" gorm:"index"`
}

func (Grant) TableName

func (Grant) TableName() string
type Link struct {
	Model
	FsID           string            `json:"fsID"`
	FsPath         string            `json:"FsPath"`
	ServerAddress  string            `json:"serverAddress"`
	SubPath        string            `json:"subPath" gorm:"column:subpath"`
	Type           string            `json:"type"`
	PropertiesJson string            `json:"-" gorm:"column:properties;type:text;default:'{}'"`
	PropertiesMap  map[string]string `json:"properties" gorm:"-"`
	UserName       string            `json:"userName"`
}

Link defined file system model, which can be used to create link

func (*Link) AfterFind

func (s *Link) AfterFind(*gorm.DB) error

AfterFind is the callback methods doing after the find link

func (*Link) BeforeSave

func (s *Link) BeforeSave(*gorm.DB) error

BeforeSave is the callback methods for saving file system

func (Link) TableName

func (Link) TableName() string

type Model

type Model struct {
	ID         string    `json:"id"`
	CreatedAt  time.Time `json:"-"`
	UpdatedAt  time.Time `json:"-"`
	CreateTime string    `json:"createTime"           gorm:"-"`
	UpdateTime string    `json:"updateTime,omitempty" gorm:"-"`
}

func (*Model) AfterFind

func (m *Model) AfterFind(tx *gorm.DB) error

func (*Model) BeforeCreate

func (m *Model) BeforeCreate(tx *gorm.DB) error

BeforeCreate the function do the operation before creating file system or link

type User

type User struct {
	Pk        int64          `json:"-" gorm:"primaryKey;autoIncrement"`
	CreatedAt time.Time      `json:"createTime"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-"`
	UserInfo  `gorm:"embedded"`
}

func (User) TableName

func (User) TableName() string

type UserInfo

type UserInfo struct {
	Name     string `gorm:"uniqueIndex" json:"name"`
	Password string `json:"-"`
}

Jump to

Keyboard shortcuts

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