Skip to content

Commit

Permalink
Rename PayloadType
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-casper committed Aug 23, 2024
1 parent d0953ff commit cf46ca6
Show file tree
Hide file tree
Showing 9 changed files with 530 additions and 524 deletions.
6 changes: 3 additions & 3 deletions binary_port/src/binary_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use casper_types::{
use crate::{
binary_response_header::BinaryResponseHeader,
error_code::ErrorCode,
payload_type::{PayloadEntity, PayloadType},
response_type::{PayloadEntity, ResponseType},
};

#[cfg(test)]
Expand Down Expand Up @@ -40,7 +40,7 @@ impl BinaryResponse {

/// Creates new binary response from raw bytes.
pub fn from_raw_bytes(
payload_type: PayloadType,
payload_type: ResponseType,
payload: Vec<u8>,
protocol_version: ProtocolVersion,
) -> Self {
Expand All @@ -59,7 +59,7 @@ impl BinaryResponse {
BinaryResponse::new_error(ErrorCode::InternalError, protocol_version),
|payload| BinaryResponse {
payload,
header: BinaryResponseHeader::new(Some(V::PAYLOAD_TYPE), protocol_version),
header: BinaryResponseHeader::new(Some(V::RESPONSE_TYPE), protocol_version),
},
)
}
Expand Down
6 changes: 3 additions & 3 deletions binary_port/src/binary_response_and_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use casper_types::{

use crate::{
binary_response::BinaryResponse, original_request_context::OriginalRequestContext,
payload_type::PayloadEntity, PayloadType,
response_type::PayloadEntity, ResponseType,
};

use crate::record_id::RecordId;
Expand Down Expand Up @@ -44,7 +44,7 @@ impl BinaryResponseAndRequest {
protocol_version: ProtocolVersion,
) -> BinaryResponseAndRequest {
let response = BinaryResponse::from_raw_bytes(
PayloadType::from_record_id(record_id, false),
ResponseType::from_record_id(record_id, false),
data.to_bytes().unwrap(),
protocol_version,
);
Expand All @@ -58,7 +58,7 @@ impl BinaryResponseAndRequest {
protocol_version: ProtocolVersion,
) -> BinaryResponseAndRequest {
let response = BinaryResponse::from_raw_bytes(
PayloadType::from_record_id(record_id, true),
ResponseType::from_record_id(record_id, true),
bincode::serialize(data).unwrap(),
protocol_version,
);
Expand Down
7 changes: 5 additions & 2 deletions binary_port/src/binary_response_header.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{error_code::ErrorCode, payload_type::PayloadType};
use crate::{error_code::ErrorCode, response_type::ResponseType};
use casper_types::{
bytesrepr::{self, FromBytes, ToBytes},
ProtocolVersion,
Expand All @@ -19,7 +19,10 @@ pub struct BinaryResponseHeader {

impl BinaryResponseHeader {
/// Creates new binary response header representing success.
pub fn new(returned_data_type: Option<PayloadType>, protocol_version: ProtocolVersion) -> Self {
pub fn new(
returned_data_type: Option<ResponseType>,
protocol_version: ProtocolVersion,
) -> Self {
Self {
protocol_version,
error: ErrorCode::NoError as u16,
Expand Down
4 changes: 2 additions & 2 deletions binary_port/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ mod key_prefix;
mod minimal_block_info;
mod node_status;
mod original_request_context;
mod payload_type;
mod purse_identifier;
pub mod record_id;
mod response_type;
mod speculative_execution_result;
mod state_request;
mod type_wrappers;
Expand All @@ -42,9 +42,9 @@ pub use information_request::{
pub use key_prefix::KeyPrefix;
pub use minimal_block_info::MinimalBlockInfo;
pub use node_status::NodeStatus;
pub use payload_type::{PayloadEntity, PayloadType};
pub use purse_identifier::PurseIdentifier;
pub use record_id::{RecordId, UnknownRecordId};
pub use response_type::{PayloadEntity, ResponseType};
pub use speculative_execution_result::SpeculativeExecutionResult;
pub use state_request::GlobalStateRequest;
pub use type_wrappers::{
Expand Down
Loading

0 comments on commit cf46ca6

Please sign in to comment.