Documentation ¶
Overview ¶
Collection management handlers. Document management handlers. Index management handlers. Miscellaneous function handlers. Query handlers.
Register HTTP API endpoints and handle authorization requirements.
Without specifying authorization parameters in the command line, tiedot server does not require any authorization on any endpoint.
tiedot supports two authorization mechanisms: - Pre-shared authorization token The API endpoints will require 'Authorization: token PRE_SHARED_TOKEN' header. The pre-shared token is specified in command line parameter "-authtoken". Client request example: curl -I -H "Authorization: token PRE_SHARED_TOKEN" http://127.0.0.1:8080/all - JWT (JSON Web Token) The sophisticated mechanism offers finer-grained access control, separated by individual users. Access to specific endpoints are granted explicitly to each user.
These API endpoints will never require authorization: / (root), /version, and /memstats
Index ¶
- Constants
- Variables
- func All(w http.ResponseWriter, r *http.Request)
- func ApproxDocCount(w http.ResponseWriter, r *http.Request)
- func Count(w http.ResponseWriter, r *http.Request)
- func Create(w http.ResponseWriter, r *http.Request)
- func Delete(w http.ResponseWriter, r *http.Request)
- func Drop(w http.ResponseWriter, r *http.Request)
- func Dump(w http.ResponseWriter, r *http.Request)
- func Get(w http.ResponseWriter, r *http.Request)
- func GetPage(w http.ResponseWriter, r *http.Request)
- func Index(w http.ResponseWriter, r *http.Request)
- func Indexes(w http.ResponseWriter, r *http.Request)
- func Insert(w http.ResponseWriter, r *http.Request)
- func MemStats(w http.ResponseWriter, r *http.Request)
- func Query(w http.ResponseWriter, r *http.Request)
- func Rename(w http.ResponseWriter, r *http.Request)
- func Require(w http.ResponseWriter, r *http.Request, key string, val *string) bool
- func Scrub(w http.ResponseWriter, r *http.Request)
- func Shutdown(w http.ResponseWriter, r *http.Request)
- func Start(dir string, port int, ...)
- func Sync(w http.ResponseWriter, r *http.Request)
- func Unindex(w http.ResponseWriter, r *http.Request)
- func Update(w http.ResponseWriter, r *http.Request)
- func Version(w http.ResponseWriter, r *http.Request)
- func Welcome(w http.ResponseWriter, r *http.Request)
Constants ¶
const ( // JWT Record and claim JWT_COL_NAME = "jwt" JWT_USER_ATTR = "user" JWT_PASS_ATTR = "pass" JWT_ENDPOINTS_ATTR = "endpoints" JWT_COLLECTIONS_ATTR = "collections" JWT_USER_ADMIN = "admin" // JWT claim JWT_EXPIRY = "exp" )
Variables ¶
var (
HttpDB *db.DB // HTTP API endpoints operate on this database
)
Functions ¶
func ApproxDocCount ¶
func ApproxDocCount(w http.ResponseWriter, r *http.Request)
Return approximate number of documents in the collection.
func Count ¶
func Count(w http.ResponseWriter, r *http.Request)
Execute a query and return number of documents from the result.
func Dump ¶
func Dump(w http.ResponseWriter, r *http.Request)
Copy this database into destination directory.
func GetPage ¶
func GetPage(w http.ResponseWriter, r *http.Request)
Divide documents into roughly equally sized pages, and return documents in the specified page.
func Insert ¶
func Insert(w http.ResponseWriter, r *http.Request)
Insert a document into collection.
func MemStats ¶
func MemStats(w http.ResponseWriter, r *http.Request)
Return server memory statistics.
func Query ¶
func Query(w http.ResponseWriter, r *http.Request)
Execute a query and return documents from the result.
func Require ¶
Store form parameter value of specified key to *val and return true; if key does not exist, set HTTP status 400 and return false.
func Scrub ¶
func Scrub(w http.ResponseWriter, r *http.Request)
De-fragment collection free space and fix corrupted documents.
func Shutdown ¶
func Shutdown(w http.ResponseWriter, r *http.Request)
Flush and close all data files and shutdown the entire program.
Types ¶
This section is empty.