@@ -446,14 +446,17 @@ pub struct Job {
446446 /// Serialized span context for trace propagation.
447447 pub span_context : Option < String > ,
448448 /// Encryption configuration for this job's payload (if encrypted).
449+ #[ cfg( feature = "encryption" ) ]
449450 pub encryption_config : Option < crate :: encryption:: EncryptionConfig > ,
450451 /// List of field names that contain PII and should be encrypted.
451452 pub pii_fields : Vec < String > ,
452453 /// Retention policy for encrypted data (overrides default if specified).
454+ #[ cfg( feature = "encryption" ) ]
453455 pub retention_policy : Option < crate :: encryption:: RetentionPolicy > ,
454456 /// Whether the payload is currently encrypted.
455457 pub is_encrypted : bool ,
456458 /// Encrypted payload data (if job is encrypted).
459+ #[ cfg( feature = "encryption" ) ]
457460 pub encrypted_payload : Option < crate :: encryption:: EncryptedPayload > ,
458461}
459462
@@ -528,10 +531,13 @@ impl Job {
528531 correlation_id : None ,
529532 parent_span_id : None ,
530533 span_context : None ,
534+ #[ cfg( feature = "encryption" ) ]
531535 encryption_config : None ,
532536 pii_fields : Vec :: new ( ) ,
537+ #[ cfg( feature = "encryption" ) ]
533538 retention_policy : None ,
534539 is_encrypted : false ,
540+ #[ cfg( feature = "encryption" ) ]
535541 encrypted_payload : None ,
536542 }
537543 }
@@ -611,10 +617,13 @@ impl Job {
611617 correlation_id : None ,
612618 parent_span_id : None ,
613619 span_context : None ,
620+ #[ cfg( feature = "encryption" ) ]
614621 encryption_config : None ,
615622 pii_fields : Vec :: new ( ) ,
623+ #[ cfg( feature = "encryption" ) ]
616624 retention_policy : None ,
617625 is_encrypted : false ,
626+ #[ cfg( feature = "encryption" ) ]
618627 encrypted_payload : None ,
619628 }
620629 }
@@ -968,10 +977,13 @@ impl Job {
968977 correlation_id : None ,
969978 parent_span_id : None ,
970979 span_context : None ,
980+ #[ cfg( feature = "encryption" ) ]
971981 encryption_config : None ,
972982 pii_fields : Vec :: new ( ) ,
983+ #[ cfg( feature = "encryption" ) ]
973984 retention_policy : None ,
974985 is_encrypted : false ,
986+ #[ cfg( feature = "encryption" ) ]
975987 encrypted_payload : None ,
976988 } )
977989 }
@@ -1722,6 +1734,7 @@ impl Job {
17221734 /// assert!(job.has_encryption());
17231735 /// # }
17241736 /// ```
1737+ #[ cfg( feature = "encryption" ) ]
17251738 pub fn with_encryption ( mut self , config : crate :: encryption:: EncryptionConfig ) -> Self {
17261739 self . encryption_config = Some ( config) ;
17271740 self
@@ -1780,6 +1793,7 @@ impl Job {
17801793 /// .with_retention_policy(RetentionPolicy::DeleteAfter(Duration::from_secs(3600)));
17811794 /// # }
17821795 /// ```
1796+ #[ cfg( feature = "encryption" ) ]
17831797 pub fn with_retention_policy ( mut self , policy : crate :: encryption:: RetentionPolicy ) -> Self {
17841798 self . retention_policy = Some ( policy) ;
17851799 self
@@ -1805,7 +1819,14 @@ impl Job {
18051819 /// }
18061820 /// ```
18071821 pub fn has_encryption ( & self ) -> bool {
1808- self . encryption_config . is_some ( )
1822+ #[ cfg( feature = "encryption" ) ]
1823+ {
1824+ self . encryption_config . is_some ( )
1825+ }
1826+ #[ cfg( not( feature = "encryption" ) ) ]
1827+ {
1828+ false
1829+ }
18091830 }
18101831
18111832 /// Checks if this job has PII fields configured.
@@ -1879,6 +1900,7 @@ impl Job {
18791900 /// assert_eq!(retrieved_config.algorithm, EncryptionAlgorithm::AES256GCM);
18801901 /// # }
18811902 /// ```
1903+ #[ cfg( feature = "encryption" ) ]
18821904 pub fn get_encryption_config ( & self ) -> Option < & crate :: encryption:: EncryptionConfig > {
18831905 self . encryption_config . as_ref ( )
18841906 }
@@ -1901,6 +1923,7 @@ impl Job {
19011923 /// assert_eq!(job.get_retention_policy(), Some(&policy));
19021924 /// # }
19031925 /// ```
1926+ #[ cfg( feature = "encryption" ) ]
19041927 pub fn get_retention_policy ( & self ) -> Option < & crate :: encryption:: RetentionPolicy > {
19051928 self . retention_policy . as_ref ( )
19061929 }
@@ -1920,17 +1943,24 @@ impl Job {
19201943 /// assert!(!job.should_cleanup_encrypted_data());
19211944 /// ```
19221945 pub fn should_cleanup_encrypted_data ( & self ) -> bool {
1923- if let Some ( encrypted_payload) = & self . encrypted_payload {
1924- encrypted_payload. should_delete_now ( )
1925- } else if let Some ( retention_policy) = & self . retention_policy {
1926- retention_policy. should_delete_now (
1927- self . created_at ,
1928- self . completed_at ,
1929- self . encryption_config
1930- . as_ref ( )
1931- . and_then ( |c| c. default_retention ) ,
1932- )
1933- } else {
1946+ #[ cfg( feature = "encryption" ) ]
1947+ {
1948+ if let Some ( encrypted_payload) = & self . encrypted_payload {
1949+ encrypted_payload. should_delete_now ( )
1950+ } else if let Some ( retention_policy) = & self . retention_policy {
1951+ retention_policy. should_delete_now (
1952+ self . created_at ,
1953+ self . completed_at ,
1954+ self . encryption_config
1955+ . as_ref ( )
1956+ . and_then ( |c| c. default_retention ) ,
1957+ )
1958+ } else {
1959+ false
1960+ }
1961+ }
1962+ #[ cfg( not( feature = "encryption" ) ) ]
1963+ {
19341964 false
19351965 }
19361966 }
0 commit comments