func (self *ProtobufRequestHandler) handleWrites(request *protocol.Request, conn net.Conn) { shard := self.clusterConfig.GetLocalShardById(*request.ShardId) log.Debug("HANDLE: (%d):%d:%v", self.clusterConfig.LocalServer.Id, request.GetId(), shard) err := shard.WriteLocalOnly(request) var errorMsg *string if err != nil { log.Error("ProtobufRequestHandler: error writing local shard: %s", err) errorMsg = protocol.String(err.Error()) } response := &protocol.Response{RequestId: request.Id, Type: &self.writeOk, ErrorMessage: errorMsg} if err := self.WriteResponse(conn, response); err != nil { log.Error("ProtobufRequestHandler: error writing local shard: %s", err) } }
func (self *ProtobufRequestHandler) handleWrites(request *protocol.Request, conn net.Conn) { shard := self.clusterConfig.GetLocalShardById(*request.ShardId) log.Debug("HANDLE: (%d):%d:%v", self.clusterConfig.LocalServer.Id, request.GetId(), shard) err := shard.WriteLocalOnly(request) var response *protocol.Response if err != nil { log.Error("ProtobufRequestHandler: error writing local shard: %s", err) response = &protocol.Response{ RequestId: request.Id, Type: protocol.Response_ERROR.Enum(), ErrorMessage: protocol.String(err.Error()), } } else { response = &protocol.Response{ RequestId: request.Id, Type: protocol.Response_END_STREAM.Enum(), } } if err := self.WriteResponse(conn, response); err != nil { log.Error("ProtobufRequestHandler: error writing local shard: %s", err) } }