Documentation ¶
Index ¶
- Constants
- Variables
- func ReadPemFile(path string) ([]byte, error)
- type Bluzelle
- func (blz *Bluzelle) AddWriters(pubKeys ...string)
- func (blz *Bluzelle) Close()
- func (blz *Bluzelle) Create()
- func (blz *Bluzelle) CreateDB() error
- func (blz *Bluzelle) Delete()
- func (blz *Bluzelle) DeleteDB() error
- func (blz *Bluzelle) DeleteWriters(pubKeys ...string)
- func (blz *Bluzelle) GetWriters()
- func (blz *Bluzelle) Has()
- func (blz *Bluzelle) HasDB() error
- func (blz *Bluzelle) Keys()
- func (blz *Bluzelle) PublicKey() string
- func (blz *Bluzelle) QuickRead()
- func (blz *Bluzelle) Read()
- func (blz *Bluzelle) Size() error
- func (blz *Bluzelle) Status() error
- func (blz *Bluzelle) Update()
- type Conn
- type Crypto
- type Metadata
Constants ¶
const ( // EcPrivateKey pem format required EcPrivateKey string = "EC PRIVATE KEY" )
const ( // RequestTimeout time limit per db request RequestTimeout = 3 * time.Second )
Variables ¶
var ( // ErrPemfileNotECDSA is returned when a wrong pem file format is provided. ErrPemfileNotECDSA = errors.New("crypto: pem file loaded not ecdsa") // ErrInvalidPayloadCase is returned when could not find a payload case. ErrInvalidPayloadCase = errors.New("crypto: invalid payload case") // ErrSigVerificationFailed is returned when a the priv/pub key generation failed. ErrSigVerificationFailed = errors.New("crypto: fail to verify sig") )
var ( // ErrRequestTimeout is returned when a outgoing request is timed out. ErrRequestTimeout = errors.New("blz: request timed out") )
var ( // ErrWsConnNotInitialized is returned when writing to a nil websocket. ErrWsConnNotInitialized = errors.New("conn: websocket connection not initialized") )
Functions ¶
func ReadPemFile ¶
ReadPemFile reads a private pem file.
Types ¶
type Bluzelle ¶
type Bluzelle struct { // Layers *Metadata *Crypto *Conn Entry string UUID string // contains filtered or unexported fields }
Bluzelle represents a client connection to the bluzelle network.
func (*Bluzelle) AddWriters ¶
AddWriters add writers to the writers list. May only be executed by the owner of the database.
func (*Bluzelle) Close ¶
func (blz *Bluzelle) Close()
Close just closes the connection to the daemon.
func (*Bluzelle) DeleteWriters ¶
DeleteWriters deletes writers from the writers list. May only be executed by the owner of the database.
func (*Bluzelle) GetWriters ¶
func (blz *Bluzelle) GetWriters()
GetWriters gets the owner and writers of the given database. The owner is the public key of the user that created the database. The writers array lists the public keys of users that are allowed to make changes to the database.
Response: JSON { owner: 'MFYwEAY...EpZop6A==', writers: [ 'MFYwEAYH...0FEoB==', ... ] }
func (*Bluzelle) PublicKey ¶
PublicKey returns a public key from the private pem given in the constructor.
type Conn ¶
type Conn struct { // Endpoint represents the entry point for the bluzelle network. Endpoint string // IncomingMsg IncomingMsg chan []byte // contains filtered or unexported fields }
Conn represents the persistent layer for Bluzelle.
func (*Conn) EndpointURL ¶
EndpointURL formats the endpoint to a ws protocol.