]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | import { HttpClient } from '@angular/common/http'; |
2 | import { Injectable } from '@angular/core'; | |
3 | ||
4 | import { Observable } from 'rxjs'; | |
5 | ||
6 | import { I18n } from '@ngx-translate/i18n-polyfill'; | |
7 | import { ErasureCodeProfile } from '../models/erasure-code-profile'; | |
8 | import { ApiModule } from './api.module'; | |
9 | ||
10 | @Injectable({ | |
11 | providedIn: ApiModule | |
12 | }) | |
13 | export class ErasureCodeProfileService { | |
14 | apiPath = 'api/erasure_code_profile'; | |
15 | ||
16 | formTooltips = { | |
9f95a23c | 17 | // Copied from /doc/rados/operations/erasure-code.*.rst |
11fdf7f2 TL |
18 | k: this.i18n(`Each object is split in data-chunks parts, each stored on a different OSD.`), |
19 | ||
20 | m: this.i18n(`Compute coding chunks for each object and store them on different OSDs. | |
21 | The number of coding chunks is also the number of OSDs that can be down without losing data.`), | |
22 | ||
23 | plugins: { | |
24 | jerasure: { | |
25 | description: this.i18n(`The jerasure plugin is the most generic and flexible plugin, | |
26 | it is also the default for Ceph erasure coded pools.`), | |
27 | technique: this.i18n(`The more flexible technique is reed_sol_van : it is enough to set k | |
28 | and m. The cauchy_good technique can be faster but you need to chose the packetsize | |
29 | carefully. All of reed_sol_r6_op, liberation, blaum_roth, liber8tion are RAID6 equivalents | |
30 | in the sense that they can only be configured with m=2.`), | |
31 | packetSize: this.i18n(`The encoding will be done on packets of bytes size at a time. | |
32 | Chosing the right packet size is difficult. | |
33 | The jerasure documentation contains extensive information on this topic.`) | |
34 | }, | |
35 | lrc: { | |
36 | description: this.i18n(`With the jerasure plugin, when an erasure coded object is stored on | |
37 | multiple OSDs, recovering from the loss of one OSD requires reading from all the others. | |
38 | For instance if jerasure is configured with k=8 and m=4, losing one OSD requires reading | |
39 | from the eleven others to repair. | |
40 | ||
41 | The lrc erasure code plugin creates local parity chunks to be able to recover using | |
42 | less OSDs. For instance if lrc is configured with k=8, m=4 and l=4, it will create | |
43 | an additional parity chunk for every four OSDs. When a single OSD is lost, it can be | |
44 | recovered with only four OSDs instead of eleven.`), | |
45 | l: this.i18n(`Group the coding and data chunks into sets of size locality. For instance, | |
46 | for k=4 and m=2, when locality=3 two groups of three are created. Each set can | |
47 | be recovered without reading chunks from another set.`), | |
48 | crushLocality: this.i18n(`The type of the crush bucket in which each set of chunks defined | |
49 | by l will be stored. For instance, if it is set to rack, each group of l chunks will be | |
50 | placed in a different rack. It is used to create a CRUSH rule step such as step choose | |
51 | rack. If it is not set, no such grouping is done.`) | |
52 | }, | |
53 | isa: { | |
54 | description: this.i18n( | |
55 | `The isa plugin encapsulates the ISA library. It only runs on Intel processors.` | |
56 | ), | |
57 | technique: this.i18n(`The ISA plugin comes in two Reed Solomon forms. | |
58 | If reed_sol_van is set, it is Vandermonde, if cauchy is set, it is Cauchy.`) | |
59 | }, | |
60 | shec: { | |
61 | description: this.i18n(`The shec plugin encapsulates the multiple SHEC library. | |
62 | It allows ceph to recover data more efficiently than Reed Solomon codes.`), | |
63 | c: this.i18n(`The number of parity chunks each of which includes each data chunk in its | |
64 | calculation range. The number is used as a durability estimator. For instance, if c=2, | |
65 | 2 OSDs can be down without losing data.`) | |
66 | } | |
67 | }, | |
68 | ||
69 | crushRoot: this.i18n(`The name of the crush bucket used for the first step of the CRUSH rule. | |
70 | For instance step take default.`), | |
71 | ||
72 | crushFailureDomain: this.i18n(`Ensure that no two chunks are in a bucket with the same failure | |
73 | domain. For instance, if the failure domain is host no two chunks will be stored on the same | |
74 | host. It is used to create a CRUSH rule step such as step chooseleaf host.`), | |
75 | ||
76 | crushDeviceClass: this.i18n(`Restrict placement to devices of a specific class | |
77 | (e.g., ssd or hdd), using the crush device class names in the CRUSH map.`), | |
78 | ||
79 | directory: this.i18n(`Set the directory name from which the erasure code plugin is loaded.`) | |
80 | }; | |
81 | ||
82 | constructor(private http: HttpClient, private i18n: I18n) {} | |
83 | ||
84 | list(): Observable<ErasureCodeProfile[]> { | |
85 | return this.http.get<ErasureCodeProfile[]>(this.apiPath); | |
86 | } | |
87 | ||
88 | create(ecp: ErasureCodeProfile) { | |
89 | return this.http.post(this.apiPath, ecp, { observe: 'response' }); | |
90 | } | |
91 | ||
11fdf7f2 TL |
92 | delete(name: string) { |
93 | return this.http.delete(`${this.apiPath}/${name}`, { observe: 'response' }); | |
94 | } | |
95 | ||
11fdf7f2 | 96 | getInfo() { |
9f95a23c | 97 | return this.http.get(`ui-${this.apiPath}/info`); |
11fdf7f2 TL |
98 | } |
99 | } |