Loading blockconnection.go +1 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ func (conn *BlockConnection) Put(entry *Record) (Status, error) { return callback.Status(), err } // P2Push func (conn *BlockConnection) P2PPush(request *P2PPushRequest) ([]Status, Status, error) { callback := &P2PPushCallback{} h := NewResponseHandler(callback) Loading callback.go +8 −1 Original line number Diff line number Diff line Loading @@ -21,14 +21,17 @@ type GenericCallback struct { status Status } // Success is called by ResponseHandler when response message received from kinetic device has OK status. func (c *GenericCallback) Success(resp *kproto.Command, value []byte) { c.status = Status{Code: OK} } // Failure is called ResponseHandler when response message received from kinetic device with status code other than OK. func (c *GenericCallback) Failure(status Status) { c.status = status } // Status returns the status after ResponseHandler processed response message from kinetic device. func (c *GenericCallback) Status() Status { return c.status } Loading @@ -39,7 +42,7 @@ type GetCallback struct { Entry Record // Entity information } // Success function extracts object information from kinetic message protocol and // Success function extracts object information from response message and // store into GetCallback.Entry. func (c *GetCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) Loading @@ -57,6 +60,7 @@ type GetKeyRangeCallback struct { Keys [][]byte // List of objects' keys within range, get from device } // Success extracts objects' keys within range, from response message. func (c *GetKeyRangeCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) c.Keys = resp.GetBody().GetRange().GetKeys() Loading @@ -68,6 +72,7 @@ type GetVersionCallback struct { Version []byte // Version of the object on device } // Success extracts object's version information from response message. func (c *GetVersionCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) c.Version = resp.GetBody().GetKeyValue().GetDbVersion() Loading @@ -79,6 +84,7 @@ type P2PPushCallback struct { Statuses []Status } // Success extracts P2Push operation status from response message. func (c *P2PPushCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) c.Statuses = make([]Status, len(resp.GetBody().GetP2POperation().GetOperation())) Loading @@ -94,6 +100,7 @@ type GetLogCallback struct { Logs Log // Device log information } // Success extracts kientic device's Log information from response message. func (c *GetLogCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) c.Logs = getLogFromProto(resp) Loading getlog.go +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import ( kproto "github.com/yongzhy/kinetic-go/proto" ) // LogType defines what type of information to retrieve by GetLog. type LogType int32 const ( Loading kinetic.go +2 −0 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ var klog = logrus.New() func init() { klog.Out = os.Stdout klog.Level = logrus.InfoLevel } // LogLevel defines the logging level for kinetic Go library. Default is LogLevelInfo. type LogLevel logrus.Level const ( Loading Loading
blockconnection.go +1 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ func (conn *BlockConnection) Put(entry *Record) (Status, error) { return callback.Status(), err } // P2Push func (conn *BlockConnection) P2PPush(request *P2PPushRequest) ([]Status, Status, error) { callback := &P2PPushCallback{} h := NewResponseHandler(callback) Loading
callback.go +8 −1 Original line number Diff line number Diff line Loading @@ -21,14 +21,17 @@ type GenericCallback struct { status Status } // Success is called by ResponseHandler when response message received from kinetic device has OK status. func (c *GenericCallback) Success(resp *kproto.Command, value []byte) { c.status = Status{Code: OK} } // Failure is called ResponseHandler when response message received from kinetic device with status code other than OK. func (c *GenericCallback) Failure(status Status) { c.status = status } // Status returns the status after ResponseHandler processed response message from kinetic device. func (c *GenericCallback) Status() Status { return c.status } Loading @@ -39,7 +42,7 @@ type GetCallback struct { Entry Record // Entity information } // Success function extracts object information from kinetic message protocol and // Success function extracts object information from response message and // store into GetCallback.Entry. func (c *GetCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) Loading @@ -57,6 +60,7 @@ type GetKeyRangeCallback struct { Keys [][]byte // List of objects' keys within range, get from device } // Success extracts objects' keys within range, from response message. func (c *GetKeyRangeCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) c.Keys = resp.GetBody().GetRange().GetKeys() Loading @@ -68,6 +72,7 @@ type GetVersionCallback struct { Version []byte // Version of the object on device } // Success extracts object's version information from response message. func (c *GetVersionCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) c.Version = resp.GetBody().GetKeyValue().GetDbVersion() Loading @@ -79,6 +84,7 @@ type P2PPushCallback struct { Statuses []Status } // Success extracts P2Push operation status from response message. func (c *P2PPushCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) c.Statuses = make([]Status, len(resp.GetBody().GetP2POperation().GetOperation())) Loading @@ -94,6 +100,7 @@ type GetLogCallback struct { Logs Log // Device log information } // Success extracts kientic device's Log information from response message. func (c *GetLogCallback) Success(resp *kproto.Command, value []byte) { c.GenericCallback.Success(resp, value) c.Logs = getLogFromProto(resp) Loading
getlog.go +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import ( kproto "github.com/yongzhy/kinetic-go/proto" ) // LogType defines what type of information to retrieve by GetLog. type LogType int32 const ( Loading
kinetic.go +2 −0 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ var klog = logrus.New() func init() { klog.Out = os.Stdout klog.Level = logrus.InfoLevel } // LogLevel defines the logging level for kinetic Go library. Default is LogLevelInfo. type LogLevel logrus.Level const ( Loading