Documentation ¶
Overview ¶
Package server provides a Glint server implementation.
Example:
s := &server.Server{ DataDir: "/var/lib/glint/", Host: "glintcore.net", Port: "443", TLSCertFile: "/etc/letsencrypt/live/glintcore.net/cert.pem", TLSKeyFile: "/etc/letsencrypt/live/glintcore.net/privkey.pem", PostgresHost: "localhost", PostgresPort: "5432", PostgresUser: "glint", PostgresPassword: "password_goes_here", PostgresDBName: "glint", } err := s.ListenAndServe()
Index ¶
- type Postgres
- func (pg *Postgres) AddAttributes(file_id int64, attrs []string) error
- func (pg *Postgres) AddFile(person_id int64, path string, data string) (int64, error)
- func (pg *Postgres) AddMetadata(personId int64, path string, attribute string, metadata string) error
- func (pg *Postgres) AddPerson(username string, fullname string, email string, password string) error
- func (pg *Postgres) Authenticate(username string, password string) (bool, error)
- func (pg *Postgres) ChangePassword(username string, password string) error
- func (pg *Postgres) Close() error
- func (pg *Postgres) Connect(host, port, user, password, dbname string) error
- func (pg *Postgres) CreateSchema() error
- func (pg *Postgres) CreateTableAttribute(tx *sql.Tx) error
- func (pg *Postgres) CreateTableFile(tx *sql.Tx) error
- func (pg *Postgres) CreateTablePerson(tx *sql.Tx) error
- func (pg *Postgres) DeleteFile(personId int64, path string) error
- func (pg *Postgres) LookupData(person_id int64, path string) (string, error)
- func (pg *Postgres) LookupDataList(person_id int64) (string, error)
- func (pg *Postgres) LookupFileId(personId int64, path string) (int64, error)
- func (pg *Postgres) LookupMetadata(personId int64, path string, attribute string) (string, error)
- func (pg *Postgres) LookupPassword(username string) (string, error)
- func (pg *Postgres) LookupPersonId(username string) (int64, error)
- func (pg *Postgres) Open(dataSourceName string) error
- func (pg *Postgres) Setup() error
- type Server
- type Storage
- type StorageFiles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
func (*Postgres) AddAttributes ¶
func (*Postgres) AddMetadata ¶
func (*Postgres) Authenticate ¶
func (*Postgres) ChangePassword ¶
func (*Postgres) CreateSchema ¶
func (*Postgres) LookupData ¶
func (*Postgres) LookupDataList ¶
func (*Postgres) LookupFileId ¶
func (*Postgres) LookupMetadata ¶
func (*Postgres) LookupPassword ¶
func (*Postgres) LookupPersonId ¶
type Server ¶
type Server struct { // DataDir is the name of a directory for storing the data sets, // metadata, and internal files that will be managed by the server. DataDir string // Host is the TCP host address to listen on. Host string // Port is the TCP port to listen on. Port string // TLSCertFile is the name of a file containing a certificate for the // server. TLSCertFile string // TLSKeyFile is the name of a file containing the matching private key // for the server. TLSKeyFile string // Logger optionally specifies a logger for the server. If nil, the // log package's standard logger is used. Logger *log.Logger // DisableCORS specifies whether to disable handling of CORS (Cross-origin // resource sharing) requests. DisableCORS bool // Debug specifies whether debugging output should be written to the log. Debug bool PostgresHost string PostgresPort string PostgresUser string PostgresPassword string PostgresDBName string DebugAllowInsecureCORS bool StaticDir string StorageModule string // contains filtered or unexported fields }
Server defines parameters for running a Glint server.
func (*Server) ListenAndServe ¶
ListenAndServe listens on the TCP host address srv.Host and port srv.Port, and handles requests on incoming connections. ListenAndServe always returns a non-nil error; after Shutdown or Close, the returned error is http.ErrServerClosed.
type Storage ¶
type Storage interface { Open(dataSourceName string) error Close() error Setup() error //AddMetadata() AddMetadata(personId int64, path string, attribute string, metadata string) error //LookupMetadata() LookupMetadata(personId int64, path string, attribute string) (string, error) //LookupData() LookupData(person_id int64, path string) (string, error) //LookupDataList() LookupDataList(person_id int64) (string, error) //AddFile() AddFile(person_id int64, path string, data string) (int64, error) //DeleteFile() DeleteFile(personId int64, path string) error LookupPassword(username string) (string, error) Authenticate(username string, password string) (bool, error) CreateTablePerson(tx *sql.Tx) error ChangePassword(username string, password string) error LookupPersonId(username string) (int64, error) AddPerson(username string, fullname string, email string, password string) error LookupFileId(personId int64, path string) (int64, error) AddAttributes(file_id int64, attrs []string) error CreateTableAttribute(tx *sql.Tx) error CreateTableFile(tx *sql.Tx) error CreateSchema() error }
func StoragePlugin ¶
type StorageFiles ¶
type StorageFiles struct {
// contains filtered or unexported fields
}
func (*StorageFiles) Close ¶
func (fs *StorageFiles) Close() error
func (*StorageFiles) Open ¶
func (fs *StorageFiles) Open(dataSourceName string) error
Click to show internal directories.
Click to hide internal directories.