Ejemplo n.º 1
1
        public void pickle(object o, Stream stream, Pickler currentPickler)
        {
            if (o.Equals(this))
            {
                SerDe.Write(stream, Opcodes.GLOBAL);
                SerDe.Write(stream, Encoding.UTF8.GetBytes(module + "\n" + "_create_row_inbound_converter" + "\n"));
            }
            else
            {
                var row = o as Row;
                if (row == null)
                {
                    throw new InvalidOperationException(this.GetType().Name + " only accepts 'Row' type objects.");
                }

                currentPickler.save(this);
                currentPickler.save(row.GetSchema());
                SerDe.Write(stream, Opcodes.TUPLE1);
                SerDe.Write(stream, Opcodes.REDUCE);

                SerDe.Write(stream, Opcodes.MARK);

                var i = 0;
                while (i < row.Size())
                {
                    currentPickler.save(row.Get(i));
                    i++;
                }

                SerDe.Write(stream, Opcodes.TUPLE);
                SerDe.Write(stream, Opcodes.REDUCE);
            }
        }
Ejemplo n.º 2
0
	public void pickle(object o, Stream outs, Pickler currentPickler) {
		PyroURI uri = (PyroURI) o;
		outs.WriteByte(Opcodes.GLOBAL);
		byte[] output=Encoding.Default.GetBytes("Pyro4.core\nURI\n");
		outs.Write(output,0,output.Length);
		outs.WriteByte(Opcodes.EMPTY_TUPLE);
		outs.WriteByte(Opcodes.NEWOBJ);
		outs.WriteByte(Opcodes.MARK);
		currentPickler.save(uri.protocol);
		currentPickler.save(uri.objectid);
		currentPickler.save(null);
		currentPickler.save(uri.host);
		currentPickler.save(uri.port);
		outs.WriteByte(Opcodes.TUPLE);
		outs.WriteByte(Opcodes.BUILD);
	}
Ejemplo n.º 3
0
	public void pickle(object o, Stream outs, Pickler currentPickler) {
		PyroException error = (PyroException) o;
		outs.WriteByte(Opcodes.GLOBAL);
		byte[] output=Encoding.Default.GetBytes("Pyro4.errors\nPyroError\n");
		outs.Write(output,0,output.Length);
		object[] args = new object[] { error.Message };
		currentPickler.save(args);
		outs.WriteByte(Opcodes.REDUCE);
		
		if(!string.IsNullOrEmpty(error._pyroTraceback))
		{
			// add _pyroTraceback attribute to the output
			Hashtable tb = new Hashtable();
			tb["_pyroTraceback"] = new string[]{ error._pyroTraceback };		// transform single string back into list
			currentPickler.save(tb);
			outs.WriteByte(Opcodes.BUILD);
		}
	}
Ejemplo n.º 4
0
        public void pickle(object o, Stream stream, Pickler currentPickler)
        {
            var schema = o as StructType;
            if (schema == null)
            {
                throw new InvalidOperationException(this.GetType().Name + " only accepts 'StructType' type objects.");
            }

            SerDe.Write(stream, Opcodes.GLOBAL);
            SerDe.Write(stream, Encoding.UTF8.GetBytes(module + "\n" + "_parse_datatype_json_string" + "\n"));
            currentPickler.save(schema.Json);
            SerDe.Write(stream, Opcodes.TUPLE1);
            SerDe.Write(stream, Opcodes.REDUCE);
        }
Ejemplo n.º 5
0
	public void pickle(object o, Stream outs, Pickler currentPickler) {
		PyroProxy proxy = (PyroProxy) o;
		outs.WriteByte(Opcodes.GLOBAL);
		byte[] output=Encoding.Default.GetBytes("Pyro4.core\nProxy\n");
		outs.Write(output,0,output.Length);
		outs.WriteByte(Opcodes.EMPTY_TUPLE);
		outs.WriteByte(Opcodes.NEWOBJ);
		
		// parameters are: pyroUri, pyroOneway(hashset), pyroTimeout
		object[] args = new object[] {   
			new PyroURI(proxy.objectid, proxy.hostname, proxy.port),
			new HashSet<object>(),
			0.0
		};
		currentPickler.save(args);
		outs.WriteByte(Opcodes.BUILD);
	}
Ejemplo n.º 6
0
        public void pickle(object o, Stream outs, Pickler currentPickler)
        {
            PyroProxy proxy = (PyroProxy) o;
            outs.WriteByte(Opcodes.GLOBAL);
            byte[] output=Encoding.Default.GetBytes("Pyro4.core\nProxy\n");
            outs.Write(output,0,output.Length);
            outs.WriteByte(Opcodes.EMPTY_TUPLE);
            outs.WriteByte(Opcodes.NEWOBJ);

            // args(8): pyroUri, pyroOneway(hashset), pyroMethods(set), pyroAttrs(set), pyroTimeout, pyroHmacKey, pyroHandshake, pyroMaxRetries
            object[] args = new object[] {
            new PyroURI(proxy.objectid, proxy.hostname, proxy.port),
            proxy.pyroOneway,
            proxy.pyroMethods,
            proxy.pyroAttrs,
            0.0,
            proxy.pyroHmacKey,
            proxy.pyroHandshake,
            0  // maxretries is not yet supported/used by pyrolite
            };
            currentPickler.save(args);
            outs.WriteByte(Opcodes.BUILD);
        }
Ejemplo n.º 7
0
		public void pickle(object o, Stream outs, Pickler currentpickler)  {
			CustomClass c=(CustomClass)o;
			currentpickler.save("customclassint="+c.x);		// write a string representation
		}
Ejemplo n.º 8
0
 public void pickle(object o, Stream outs, Pickler currentpickler)
 {
     CustomClass c=(CustomClass)o;
     currentpickler.save("customclassint="+c.x);
 }