Massiv Core Documentation

Programmer's Guide

Version 0.01b


Table of Contents

I. Overview
1. Introduction
2. Architecture
2.1. Types Of Nodes
2.2. Consistency and Failure Resistance
2.3. Basic Properties Of The Core
2.4. Core Internal Architecture Survey
3. Object Model Introduction
3.1. Object Model Design Goals
3.2. Object Model Mapping to C++
3.3. Object Model Basics
3.3.1. Properties
3.3.2. Objects
3.3.3. Pointers
II. Using Object Model
4. Managed Objects
4.1. Introduction
4.2. Managed Data
4.2.1. Properties
4.2.2. Lightweight Serializable Types
4.3. Managed Object in Detail
4.3.1. Implementation
4.3.2. Instantiation and Finalization
4.3.3. Referencing
4.3.4. ValueTypes
4.3.5. Throwable Objects and Exceptions
4.3.6. Callbacks and Event Scheduling
4.3.7. Class Kinds
4.4. Object Identification
4.4.1. ObjectId Overview
4.4.2. ObjectId Pool
4.4.3. Mandatory And Optional Part
4.4.4. ObjectId Uniqueness
4.4.5. Object Searching
4.5. Managed Objects Defined By the Core
5. Pointers
5.1. Why Managed Pointers
5.2. Overview
5.2.1. Pointer characteristics
5.3. Using pointers
5.3.1. Declaring Pointers
5.3.2. Using Cast Object
5.3.3. Assigning To Pointers
5.3.4. Comparing Pointers
5.3.5. Dereferencing Pointers
5.3.6. Special Operations
5.3.7. Migration And Replication Groups
5.3.8. Pointers To Forward Declared Classes
5.3.9. Pointer Replicas, Pointers To Object Replicas
5.3.10. Pointer Policies
5.3.11. Exceptions
5.3.12. Differences From C++ Pointers
5.3.13. Differences In Debug And Release Mode
5.3.14. Advanced Techniques
5.4. Garbage Collector
5.4.1. The Model
5.4.2. GC Roots
5.4.3. The API
5.4.4. Running And Configuring GC
6. Migration
6.1. Overview
6.2. Communication Between Objects Using Migration
6.3. Migration Types
6.4. Migration Groups
6.5. Requesting Migration
6.6. Migration Callbacks
6.7. Preventing Migrations
6.8. Detecting Migrations Between Nodes
6.9. Migration And Garbage Collector
6.10. Migration And Nodes
6.10.1. Migration Between Server Nodes
6.10.2. Migration From Client To Server Nodes
6.10.3. Migration From Server To Client Nodes
6.11. How Migrations Are Used By The Core
6.11.1. Load Balancing
6.11.2. Synchronous And Asynchronous RPC
7. Replication
7.1. Overview
7.2. Replication Model
7.2.1. Simple Example
7.2.2. Replication from Client Nodes
7.2.3. Replication and Migration
7.2.4. Replication and Class Kinds
7.3. Requesting Replication
7.3.1. Using Methods of Object
7.3.2. Node Object Pointers
7.3.3. Requesting Replication by RPC
7.4. Accessing Object Replicas
7.5. Replication-related IDL Attributes
7.5.1. Node Types
7.5.2. Choosing Properties To Replicate
7.5.3. Replication and Migration Groups
7.5.4. Recommended Node Replication Masks
7.5.5. Custom Replication Flags and Masks
7.6. Replication and Migration Compared
7.7. Consistency of Replication Groups
7.8. Callbacks to Replicas
7.9. Replica Manager
7.10. Allowed and Illegal Operations
7.11. Massiv Demo Examples
7.12. Configuration and Statistics
8. Remote Procedure Call
8.1. Overview
8.2. RPC Model
8.3. Asynchronous RPC
8.3.1. Immediate Asynchronous RPC
8.3.2. Scheduling Asynchronous RPC
8.4. Synchronous RPC
8.4.1. Performing The Call
8.4.2. SRPC Exceptions
8.4.3. SRPC Security and Limitations
8.4.4. Advantages and Disadvantages of SRPC
8.5. Advanced Techniques
8.5.1. Triggering Replication by RPC
8.5.2. Synchronous RPC Optimizations
8.5.3. Asynchronous RPC to Replicas
8.5.4. Getting Reply to Asynchronous RPC
8.5.5. Dynamic RPC
8.6. Configuration and Statistics
8.7. Method Arguments and Results
8.7.1. Pointers
8.7.2. Managed Objects
8.8. RPC Reference Guide
9. Introduction to IDL
9.1. What Is IDL?
9.2. IDL in the Massiv
9.2.1. idl.list files
10. IDL Syntax
10.1. Basic Syntax Overview
10.2. Tokens
10.2.1. Comments
10.2.2. Identifiers
10.2.3. Keywords
10.2.4. Literals
10.3. Parser Directives
10.4. Massiv IDL Grammar
10.5. Name Lookup and Scoping
10.6. Namespaces
10.7. Enumerations
10.8. Attributes
10.8.1. Attribute Definition
10.8.2. Attribute Types
10.8.3. Attribute Default Values
10.8.4. Attribute Value Assignment
10.8.5. Expressions
10.8.6. Attribute Value Lookup
10.9. Classes
10.9.1. Forward Declaration
10.9.2. Class Definition
10.9.3. Class Attributes
10.9.4. Class Inheritance Specification
10.10. Properties
10.10.1. Property Attributes
10.11. Methods
10.11.1. Method Attributes
10.11.2. Method Arguments and Results
10.12. Special Directives
10.12.1. The include_header Directive
10.13. Property and Argument Types
10.13.1. Boolean
10.13.2. Integers With Fixed-length Serialization
10.13.3. Integers With Variable-length Serialization
10.13.4. Enumeration Type
10.13.5. Floating-Point
10.13.6. Floating-Point With Quantized Serialization
10.13.7. String
10.13.8. Time
10.13.9. Event Handle
10.13.10. Math Vectors
10.13.11. Orientation
10.13.12. Color
10.13.13. Pointers
10.13.14. Managed Class Type
10.13.15. Pair
10.13.16. Array
10.13.17. Set
10.13.18. Dictionary
11. Classes Generated From the IDL
11.1. RPC Related Classes Generated
11.1.1. RPCStubs Objects
12. Metaobjects
12.1. Overview
12.2. MetaObject class
12.2.1. Obtaining a MetaObject
12.2.2. Passing Pointers to MetaObject Methods
12.2.3. Class Information
12.2.4. Properties
12.2.5. Methods
12.2.6. Massiv Core and Demo Examples
12.3. ObjectFactory Class
13. Creating Managed Class
13.1. Overview
13.2. Creating a Library
13.3. Adding New IDLs to a Library
13.4. Interface Class
13.4.1. IDL Description of HelloInterface
13.4.2. C++ Definition of HelloInterface
13.5. Implementation Class
13.5.1. IDL description of Hello
13.5.2. C++ implementation of Hello
13.6. Linking With the Massiv Demo
14. Special Objects
14.1. Overview
14.2. Node Object
14.2.1. Functionality Of Server Node Objects
14.2.2. Functionality Of Client Node Objects
14.3. Account Object
14.3.1. Account Objects in Massiv Demo
III. Writing Application Over Massiv
15. Massiv Application Skeleton
15.1. Overview
15.2. Initializing the Core
15.3. Downloading Prerequisite Data
15.4. Connecting To the Simulation
15.5. Running the Main Loop
15.6. Disconnecting From the Simulation
15.7. Shutting Down the Core
15.8. More On the System Loops
15.9. An Example
16. Global Objects And System Interface
16.1. Global objects
16.1.1. List of Global Objects
16.1.2. Global Logging Interface
16.2. System Interface
17. Threading Model
17.1. The Model Used By the Core
17.2. When the Core Runs
17.3. What Happens When the Core Runs
17.4. Configuration
17.5. Worker Threads
18. Simulation Time
19. Registry
19.1. Survey
19.2. Registry Structure
19.2.1. Config Variables
19.2.2. Symbolic Links
19.3. Usage
19.3.1. Filling The Registry With Data
19.3.2. Accessing Variables In The Registry
19.3.3. Iterating and Searching The Registry
19.3.4. Settings
19.3.5. Statistics
19.3.6. Configuration Files Syntax
20. Logger Library
20.1. Survey
20.2. Logger Structure
20.3. Usage
20.4. Logger Configuration Using the Registry
20.4.1. Registry Nodes Involved Into Logger Configuration
20.4.2. Logger Destinations Declaration
20.4.3. Selector Elements Declaration
20.4.4. Selectors Declaration
20.4.5. Example
21. Massiv Filesystem
22. Command Line Parser
22.1. Survey
22.2. Usage
IV. Administration
23. Archivation and Startup
23.1. Archivation
23.2. Simulation Startup
24. Data Service
24.1. .update_description structure
24.2. Data Objects
24.3. Download/upload speed
25. Auxiliary Utilities
25.1. Short info about auxiliary utilities provided with the Massiv
26. Registry Configuration File Syntax
26.1. Variable, Node and Alias Names
26.2. Structure of the File
26.3. Additional Stuff
26.3.1. Comments
26.3.2. Blanks
26.3.3. Includes
26.4. Example
27. Understanding Configuration Values Related to the Core
27.1. Account Manager
27.2. Archive Database
27.3. Archive Manager
27.4. Balancer
27.5. Data Service
27.6. File Acknowledgement Manager
27.7. Garbage Collector
27.8. Logger
27.9. Network
27.10. Node Manager
27.11. Node Database
27.12. Object Manager
27.13. Path Manager
27.14. Remote Procedure Call
27.15. Replication
27.16. Scheduler
27.17. Time Manager
27.18. Volume Manager
27.19. Well Known Object ID Database
28. Handling Accounts
A. Network Layer
A.1. Locking And Unlocking Buffers
A.2. Managing Connections
A.3. Connection Creation Process
A.4. Configuration And Statistics
B. Load Balancing
B.1. Optimization Techniques
B.2. Configuring the Balancer
C. Core Requirements
D. Auxiliary Utilities to Build Massiv and Documentation
D.1. Massiv Build Tools
D.2. The idl.list File
D.3. Documentation Tools
D.3.1. Doxygen
D.3.2. DocBook
E. Compiling Massiv
E.1. Compilation of the Core
E.1.1. Downloading Massiv from CVS
E.1.2. Compilation Steps Common for All Platforms
E.1.3. Compilation under Windows (MSVC)
E.1.4. Compilation under Linux (GCC)
E.2. Compilation of Documentation
F. Example Listings
F.1. Creating Managed Class

List of Figures

2.1. Massiv deployment diagram - example
2.2. Survey of the internal architecture of the Core
4.1. Misused multiple inheritance
4.2. Multiple inheritance properly used
7.1. Replication Example
8.1. Inititating Remote Call
8.2. Performing Remote Call
8.3. Sending Back Call Results
8.4. Delivering Call Results
15.1. System Phases
D.1. Configuration phase
D.2. Generating sources
D.3. Compile and link the project

List of Tables

5.1. Managed Pointer Types
5.2. Pointer assignment variants
5.3. Pointer compare variants
5.4. Pointer member methods
5.5. Pointer mutation
5.6. Exceptions thrown by the pointer subsystem
5.7. Public API to the Garbage Collector
6.1. Migration failure reasons
7.1. Property replication flags
7.2. Pointer replication flags
7.3. Replication masks
7.4. Differences between the copy-and-migrate and the replication
7.5. Replication-related object_update() reasons
8.1. RPCFlags
8.2. ResultObject state
10.1. Massiv IDL EBNF
10.2. Attribute Type
10.3. Class attributes defined in the Core IDL
10.4. Property attributes defined in the Core IDL
10.5. Method attributes defined in the Core IDL
10.6. Boolean type mapping
10.7. Integral type mapping
10.8. VLint type mapping
10.9. Enumeration type mapping
10.10. Floating-point type mapping
10.11. Quantized floating-point type mapping
10.12. String type mapping
10.13. Time type mapping
10.14. Event handle type mapping
10.15. Math vector type mapping
10.16. Orientation type mapping
10.17. Color type mapping
10.18. Strong pointer type mapping
10.19. Weak pointer type mapping
10.20. Remote pointer type mapping
10.21. Managed class type mapping
10.22. Pair type mapping
10.23. Value array type mapping
10.24. Property array type mapping
10.25. Set type mapping
10.26. Multi-set type mapping
10.27. Dictionary type mapping
10.28. Multi-dictionary type mapping
11.1. Classes generated on the basis of the IDL
15.1. System Phases
15.2. Download data system loop
15.3. Connect system loop
15.4. Run system loop
15.5. Disconnect system loop
15.6. Generic system loop
19.1. Config Variable Types
19.2. Basic Registry iterator methods
19.3. Registry Enumeration and Search Methods
19.4. Registry Enumeration and Search Methods
20.1. Logger Destinations
20.2. Logger Selector Attributes
25.1. Utilities
25.2. Un*x utility binary names
A.1. Process of the successful connection creation

List of Examples

7.1. Determining State of an Object
7.2. Usage of replica manager
8.1. RPC Example - IDL for class Foo
8.2. Dynamic RPC
10.1. A class description in the IDL
12.1. Obtaining a MetaObject
12.2. Class introspection
12.3. Property introspection
12.4. Method introspection
20.1. Logger destinations declaration example
20.2. Declaring two selector elements of names Element1 and Element2
20.3. Selectors declaration
20.4. Configuration using the registry - complex example
21.1. Volume manager usage
22.1. Cmdline parser usage example
26.1. Registry configuration file syntax
F.1. makefile.gen
F.2. idl.list
F.3. hello_interface.idl
F.4. hello_interface.h
F.5. hello.idl
F.6. hello.h
F.7. hello.cpp