pub fn new(
        session: &SessionRef,
        id: DataObjectId,
        client_keep: bool,
        label: String,
        data_type: DataType,
        data: Option<Vec<u8>>,
        attributes: Attributes,
    ) -> Self {
        assert_eq!(id.get_session_id(), session.get_id());
        let s = DataObjectRef::wrap(DataObject {
            id: id,
            producer: Default::default(),
            label: label,
            state: if data.is_none() {
                DataObjectState::Unfinished
            } else {
                DataObjectState::Finished
            },
            consumers: Default::default(),
            need_by: Default::default(),
            scheduled: Default::default(),
            located: Default::default(),
            assigned: Default::default(),
            session: session.clone(),
            client_keep: client_keep,
            finish_hooks: Vec::new(),
            size: data.as_ref().map(|d| d.len()),
            data_type,
            data: data,
            attributes: attributes,
        });
        // add to session
        session.get_mut().objects.insert(s.clone());
        s
    }
/// Create new data object and link it to the owning session.
Create new data object and link it to the owning session.
Create new data object and link it to the owning session .
pub fn new(
        session: &SessionRef,
        id: DataObjectId,
        client_keep: bool,
        label: String,
        data_type: DataType,
        data: Option<Vec<u8>>,
        attributes: Attributes,
    ) -> Self {
        assert_eq!(id.get_session_id(), session.get_id());
        let s = DataObjectRef::wrap(DataObject {
            id: id,
            producer: Default::default(),
            label: label,
            state: if data.is_none() {
                DataObjectState::Unfinished
            } else {
                DataObjectState::Finished
            },
            consumers: Default::default(),
            need_by: Default::default(),
            scheduled: Default::default(),
            located: Default::default(),
            assigned: Default::default(),
            session: session.clone(),
            client_keep: client_keep,
            finish_hooks: Vec::new(),
            size: data.as_ref().map(|d| d.len()),
            data_type,
            data: data,
            attributes: attributes,
        });
        // add to session
        session.get_mut().objects.insert(s.clone());
        s
    }
pub fn new ( session : & SessionRef , id : DataObjectId , client_keep : bool , label : String , data_type : DataType , data : Option < Vec < u8 > > , attributes : Attributes , ) -> Self { assert_eq ! ( id get_session_id ( ) session get_id ( ) ) ; let s = DataObjectRef :: wrap ( DataObject { id : id , producer : Default :: default ( ) , label : label , state : if data . is_none ( ) { DataObjectState :: Unfinished } else { DataObjectState :: Finished } , consumers : Default :: default ( ) , need_by : Default :: default ( ) , scheduled : Default :: default ( ) , located : Default :: default ( ) , assigned : Default :: default ( ) , session : session . clone ( ) , client_keep : client_keep , finish_hooks : Vec :: new ( ) , size : data . as_ref ( ) . map ( | d | d . len ( ) ) , data_type , data : data , attributes : attributes , } ) ; // add to session session . get_mut ( ) . objects . insert ( s . clone ( ) ) ; s }
Create new data object and link it to the owning session.
Create new data object and link it to the owning session .
session
&SessionRef
id
DataObjectId
client_keep
bool
label
String
data_type
DataType
data
Option<Vec<u8>>
attributes
Attributes
session
&SessionRef
id
DataObjectId
client_keep
bool
label
String
data_type
DataType
data
Option<Vec<u8>>
attributes
Attributes