1Data::ObjectDriver::DriUvseerr::CSoinmtprliDebaPutatare:td:iOtPbiejorenlc(t3DD)orciuvmeern:t:aDtriiovner::SimplePartition(3)
2
3
4

NAME

6       Data::ObjectDriver::Driver::SimplePartition - basic partitioned object
7       driver
8

SYNOPSIS

10           package ParentObject;
11           use base qw( Data::ObjectDriver::BaseObject );
12
13           __PACKAGE__->install_properties({
14               columns     => [ 'parent_id', 'partition_id', ... ],
15               ...
16               driver      => Data::ObjectDriver::Driver::DBI->new( @$GLOBAL_DB_INFO ),
17               primary_key => 'parent_id',
18           });
19
20           __PACKAGE__->has_partitions(
21               number     => scalar @PARTITIONS,
22               get_driver => \&get_driver_by_partition,
23           );
24
25           package SomeObject;
26           use base qw( Data::ObjectDriver::BaseObject );
27
28           __PACKAGE__->install_properties({
29               ...
30               driver               => Data::ObjectDriver::Driver::SimplePartition->new(
31                                           using => 'ParentObject'
32                                       ),
33               primary_key          => ['parent_id', 'object_id'],
34           });
35

DESCRIPTION

37       Data::ObjectDriver::Driver::SimplePartition is a basic driver for
38       objects partitioned into separate databases. See
39       Data::ObjectDriver::Driver::Partition for more about partitioning
40       databases.
41
42       SimplePartition helps you partition objects into databases based on
43       their association with one record of a parent class. If your classes
44       don't meet the requirements imposed by SimplePartition, you can still
45       write your own partitioning driver. See
46       Data::ObjectDriver::Driver::Partition.
47

SUGGESTED PRACTICES

49       Often this is used for user partitioning, where the parent class is
50       your user account class; all records of other classes that are "owned"
51       by that user are partitioned into the same database. This allows you to
52       scale horizontally with the number of users, at the cost of
53       complicating querying multiple users' data together.
54
55       SimplePartition will load the related instance of the parent class
56       every time it needs to find the partition for a related object.
57       Consider using a minimal mapping class for the parent, keeping as much
58       data as possible in other related classes. For example, if "User" were
59       your parent class, you might keep only the user ID and other data used
60       to find users (such as login name and email address) in "User", keeping
61       further profile data in another "UserProfile" class.
62
63       As all the partitioned classes related to a given parent class will
64       share the same "partition_get_driver" logic to turn a partition ID into
65       a driver, you might put the "partition_get_driver" function in the
66       parent class, or use a custom subclass of SimplePartition that contains
67       and automatically specifies the "partition_get_driver" function.
68

USAGE

70   Data::ObjectDriver::Driver::SimplePartition->new(%params)
71       Creates a new basic partitioning driver for a particular class. The
72       required members of %params are:
73
74       ·   "using"
75
76           The name of the parent class on which the driven class is
77           partitioned.
78
79           Using a class as a parent partitioned class requires these
80           properties to be defined:
81
82           ·   "columns"
83
84               The parent class must have a "partition_id" column containing a
85               partition identifier. This identifier is passed to the
86               "partition_get_driver" function to identify a driver to return.
87
88           ·   "primary_key"
89
90               The parent class's primary key must be a simple single-column
91               key, and that column must be the same as the referencing column
92               in the partitioned classes.
93
94           ·   "partition_get_driver"
95
96               The "partition_get_driver" property must be a function that
97               returns an object driver, given a partition ID and any extra
98               parameters given to the "SimplePartition" constructor.
99
100               This property can also be defined as "get_driver" in a call to
101               "Class->has_partitions()". See Data::ObjectDriver::BaseObject.
102
103       You can also include any further optional parameters you like. They
104       will be passed to the partitioned class's "partition_get_driver"
105       function as given.
106
107       A SimplePartition driver will require these properties to be defined
108       for partitioned classes:
109
110       ·   "primary_key"
111
112           Your primary key should be a complex primary key (arrayref) with
113           the simple key of the parent object for the first field.
114

DIAGNOSTICS

116       ·   "using is required."
117
118           The "using" parameter to the SimplePartition constructor is
119           required to create the partitioned class's "get_driver" function.
120           Perhaps you omitted it, or your subclass of SimplePartition did not
121           properly specify it to its parent's constructor.
122
123       ·   "Bogus classname."
124
125           The parent class name you specified in your "using" parameter does
126           not appear to be a valid class name. If you are automatically
127           generating parent class names, check that your method of converting
128           strings to class names is correct.
129
130       ·   "Failed to load parent class: error"
131
132           The parent class you specified in your "using" parameter could not
133           be loaded, for the given reason. Perhaps you didn't include its
134           location in your library path.
135
136       ·   "Partitioning driver not defined for partitioned class"
137
138           The partitioned class named in the error is configured to use the
139           SimplePartition driver but does not have a "partition_get_driver"
140           set.  Check that you intended to use SimplePartition with that
141           class or, if you're automatically specifying the
142           "partition_get_driver" function, that your technique is working
143           correctly.
144
145       ·   "Cannot extract column from terms search terms or primary key"
146
147           The SimplePartition driver could not determine from the given
148           search terms or object key what the ID of the related parent record
149           was. Check that your columns in the partitioned and parent classes
150           share the same name, and that your application includes the parent
151           ID in all "search()" calls for the partitioned class and instances
152           of partitioned objects before attempting to save them.
153
154           Optionaly you can enable a basic support of search accross multiple
155           partition by passing the 'multi_partition' arg (true value) to the
156           search query.
157
158       ·   "Member of class with ID parent ID not found"
159
160           The parent record associated with the partitioned object could not
161           be loaded.  Perhaps your application deleted the parent record
162           without removing its associated partitioned objects first.
163

BUGS AND LIMITATIONS

165       There are no known bugs in this module.
166

SEE ALSO

168       Data::ObjectDriver::Driver::Partition
169

LICENSE

171       Data::ObjectDriver is free software; you may redistribute it and/or
172       modify it under the same terms as Perl itself.
173
175       Except where otherwise noted, Data::ObjectDriver is Copyright 2005-2006
176       Six Apart, cpan@sixapart.com. All rights reserved.
177
178
179
180perl v5.12.0                    Da2t0a1:0:-O0b3j-e2c2tDriver::Driver::SimplePartition(3)
Impressum