file(fn:z,hs)

Description:

Generate a cluster file on one or more nodes.

Syntax:

file(fn:z,hs)

Note:

The function generates a cluster file on node or a sequence of nodes hs. Parameter z is zone table number. The function retrieves zone tables of composite table fn from different nodes when z is an integer sequence; z cannot be a two-level integer sequence.

Parameter:

fn

A composite table file

z

Zone table number(s), which is an integer or an integer sequence

hs

A node or a sequence of nodes

Option:

@w

Enable a remote generation with parameter z and parameter hs have a one-one-one correspondence; and is equivalent to to(hs.len()) when parameter z is absent

Return value:

A cluster file

Example:

Generate a cluster file:

 

A

 

1

=file("emp.ctx",["192.168.31.165:8281"])

Generate a cluster file on A1’s node.

2

=A1.open()

Open a cluster table.

3

=A2.memory()

Generate an in-memory cluster table.

4

=A2.close()

Close the cluster table.

Write to a composite table file remotely:

 

A

 

1

=["192.168.126.1:8281","192.168.31.165:8281"]

A sequence of nodes.

2

=file@w("emp.ctx":to(2),A1)

Write files to nodes; write 1.emp.ctx to node 192.168.126.1:8281 and 2.emp.xtx to node 192.168.31.165.

3

=create(k1,v1).record([1,10,2,20,3,30,4,40,10,100])

Return a table sequence.

4

=A2.create(#k1,v1;if(k1<4,1,2))

Generate a multizone composite table.

5

=A4.append(A3.cursor())

Append A3’s data to A4’s multizone composite table.

Retrieve zone tables from nodes to generate a cluster file:

 

A

 

1

=["192.168.126.1:8281","192.168.31.165:8281"]

Define a sequence of nodes.

2

=file("emCp.ctx":[1,2],A1)

Retrieve zone tables from nodes to generate a cluster file; 1.empCp.ctx. and 2.empCp.ctx can be stored in node 192.168.126.1 and node 192.168.31.165:8281 respectively, or both can exist in either node.

3

=A2.open()

Open A2’s cluster file.

4

=A3.memory()

Generate an in-memory cluster table from A3’s cluster table.

5

=A4.dup()

Generate a local in-memory table from an in-memory cluster table.