/// Encode Spus metadata into SPU FLV response
Encode Spus metadata into SPU FLV response
Encode Spus metadata into SPU FLV response
pub fn spu_store_metadata_to_spu_response(name: &str, spu: &SpuKV) -> FlvFetchSpuResponse {
    let public_ep = spu.public_endpoint();
    let private_ep = spu.private_endpoint();
    let flv_spu_type = match spu.spec().spu_type {
        SpuType::Custom => FlvSpuType::Custom,
        SpuType::Managed => FlvSpuType::Managed,
    };
    let flv_resolution = match spu.status().resolution {
        SpuResolution::Online => FlvSpuResolution::Online,
        SpuResolution::Offline => FlvSpuResolution::Offline,
        SpuResolution::Init => FlvSpuResolution::Init,
    };
    let flv_spu = FlvFetchSpu {
        id: *spu.id(),
        spu_type: flv_spu_type,
        public_ep: FlvEndPointMetadata {
            host: public_ep.host_string(),
            port: public_ep.port,
        },
        private_ep: FlvEndPointMetadata {
            host: private_ep.host.clone(),
            port: private_ep.port,
        },
        rack: spu.rack_clone(),
        resolution: flv_resolution,
    };
    FlvFetchSpuResponse {
        error_code: FlvErrorCode::None,
        name: name.to_owned(),
        spu: Some(flv_spu),
    }
}
pub fn spu_store_metadata_to_spu_response ( name : & str , spu : & SpuKV ) -> FlvFetchSpuResponse { let public_ep = spu . public_endpoint ( ) ; let private_ep = spu . private_endpoint ( ) ; let flv_spu_type = match spu . spec ( ) . spu_type { SpuType :: Custom => FlvSpuType :: Custom , SpuType :: Managed => FlvSpuType :: Managed , } ; let flv_resolution = match spu . status ( ) . resolution { SpuResolution :: Online => FlvSpuResolution :: Online , SpuResolution :: Offline => FlvSpuResolution :: Offline , SpuResolution :: Init => FlvSpuResolution :: Init , } ; let flv_spu = FlvFetchSpu { id : * spu . id ( ) , spu_type : flv_spu_type , public_ep : FlvEndPointMetadata { host : public_ep . host_string ( ) , port : public_ep . port , } , private_ep : FlvEndPointMetadata { host : private_ep . host . clone ( ) , port : private_ep . port , } , rack : spu . rack_clone ( ) , resolution : flv_resolution , } ; FlvFetchSpuResponse { error_code : FlvErrorCode :: None , name : name . to_owned ( ) , spu : Some ( flv_spu ) , } }
Encode Spus metadata into SPU FLV response
Encode Spus metadata into SPU FLV response
name
&str
spu
&SpuKV