NewDMap returns a new DMap client with the given options.
(name string, options ...DMapOption)
| 684 | |
| 685 | // NewDMap returns a new DMap client with the given options. |
| 686 | func (cl *ClusterClient) NewDMap(name string, options ...DMapOption) (DMap, error) { |
| 687 | var dc dmapConfig |
| 688 | for _, opt := range options { |
| 689 | opt(&dc) |
| 690 | } |
| 691 | |
| 692 | if dc.storageEntryImplementation == nil { |
| 693 | dc.storageEntryImplementation = func() storage.Entry { |
| 694 | return entry.New() |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | return &ClusterDMap{name: name, |
| 699 | config: &dc, |
| 700 | newEntry: dc.storageEntryImplementation, |
| 701 | client: cl.client, |
| 702 | clusterClient: cl, |
| 703 | }, nil |
| 704 | } |
| 705 | |
| 706 | // ClusterClientOption is a functional option for configuring a clusterClientConfig instance. |
| 707 | type ClusterClientOption func(c *clusterClientConfig) |